Questions tagged [php-5.4]

PHP 5.4 is the successor to PHP 5.3. It was released on March 1, 2012. Use this tag for version-specific issues relating to specifically to PHP 5.4.

PHP 5.4 Changes:

  • Support for traits has been added.
  • Short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];.
  • Function array dereferencing has been added, e.g. foo()[0].
  • Closures now support $this.
  • <?= is now always available, regardless of the short_open_tag php.ini option.
  • Class member access on instantiation has been added, e.g. (new Foo)->bar().
  • Class::{expr}() syntax is now supported.
  • Binary number format has been added, e.g. 0b001001101.
  • Improved parse error messages and improved incompatible arguments warnings.
  • The session extension can now track the upload progress of files.
  • Built-in development web server in CLI mode.

See Migrating from PHP 5.3.x to PHP 5.4.x for more information.

Information

  • If you want to talk about PHP or if you have a question, you can come to Chat Room 11: PHP.
  • For global question on PHP, please use the generic tag:
402 questions
2
votes
3 answers

Why is array_search not finding, unless array is sorted?

I'm having trouble understanding the result of array_search in the following example (and did not find any existing questions discussing this): 25, …
MBaas
  • 7,248
  • 6
  • 44
  • 61
2
votes
1 answer

Symfony2 intl only "en" supported

I am working on windows machine with Wamp installed and PHP 5.4.3 Currently, I am developing a web application using Symfony2. While creating a form with the FormType, I needed to insert an inputfield that takes a float instead of a String. So, I…
NightFox
  • 57
  • 1
  • 6
1
vote
1 answer

Constant expressions in PHP 5.5 or before

I'm working on a legacy PHP codebase that runs on PHP 5.4. I want to derive class-specific constants or properties based on a common constant. So for instance in PHP 5.6 or later I'd do: config.php define('CONFIG_DIR',…
Gayan Weerakutti
  • 11,904
  • 2
  • 71
  • 68
1
vote
1 answer

How to use class_exists correctly in PHP 5.4

I'm using an old system with PHP 5.4 that I can't upgrade. I had to make a small change by adding a library for PDF file generation called FPDF/FPDI that has this function: protected function getPdfParserInstance(StreamReader $streamReader) { …
Ivan
  • 14,692
  • 17
  • 59
  • 96
1
vote
1 answer

PHP: simplexml_load_file gets strange characters from an XML file with UTF-8 encoding

The simplexml_load_file() function doesn't parse the accent characters well. The file is UTF-8 encoded, the xml tag has encoding="UTF-8". I'm importing an XML file encoded in UTF-8 with simplexml_load_file() function. This file has some accent…
1
vote
1 answer

PHP Multi-cURL requests delayed until timeout

Summary I have some PHP 5.4 code which fetches a batch of Facebook/Instagram photos in parallel using multi curl. This code has been working for years, and nothing has changed as far as I can tell. I add multiple curl requests to a 'multi' request.…
IanS
  • 1,459
  • 1
  • 18
  • 23
1
vote
1 answer

How to debug why cookie is not being set with setcookie on one server but works on other?

I have included a form which takes user's input and sets a cookie with setcookie php function while processing the form. This works in one server, but doesn't work on other. The server in which the cookies isn't working shows some blank httponly…
GP92
  • 433
  • 1
  • 12
  • 30
1
vote
1 answer

how to fetch part of a string from a given string when position is not fixed in php 5.4.0

I have a code which fetches only TANID from the Cookies. Position of TANID is not fixed. This code is working fine on php 7.2 but not on php 5.4

        
ssnone
  • 35
  • 3
  • 10
1
vote
0 answers

How do I remove à and � special character?

I have a website where the database mysql collation was in latin_1 and the php files were set with . Now, the old website worked with PHP 5.4, I'm working with a 5.6 right now…
1
vote
1 answer

httpd (apache) centos fail to open stream: Permission denied

i'm facing the next error in a centos 7 server I take a look to similar questions saying that is because SELinux doesn't allow to httpd to write in my /home folder, i've tried changing the owner of the folder without success; try changing the…
ccmorataya
  • 69
  • 2
  • 9
1
vote
3 answers

Multi-PHP (5.4+7) Centos 7

I have a development VM server (Centos7+php5.4+apache2.4) and each user as it sub domain, developing its webservice. Most of the developers are obligated to code on the 5.4 php version, with mod_php as default and I have instructions to migrate to…
Papa Lopez
  • 11
  • 1
  • 2
1
vote
0 answers

Can apache 2.2 support for Php 5.4? What is minimum supported apache version for php5.4? I am using linux red hat hosting

Can apache 2.2 support for Php 5.4 and higher? If not what is minimum supported version of apache for the same?
Amol
  • 110
  • 2
  • 12
1
vote
1 answer

DateTime object declaration breaks script on PHP 5.4.16

While editing the php file it shows DateTime is not a valid method, plus when I try to use this it stops loading the rest of the page, do I have to implement something? My goal is to check either if the difference between those variables is more…
Stephanie Sotelo
  • 75
  • 1
  • 1
  • 6
1
vote
0 answers

Can't connect to LDAP from PHP - "ldap_bind(): Unable to bind to server: Can't contact LDAP server"

Running PHP 5.4.16. Here's the (simplified) code:
pastelillos
  • 11
  • 1
  • 4
1
vote
0 answers

Google PHP API Client with PHP 5.4: ERR_CONNECTION_RESET

I use the PHP 5.4 that comes with XAMPP 1.8.2-6 and try to implement get trainedmodels function with the following code. require_once 'google-api-client/vendor/autoload.php'; $client = new Google_Client(); $client->setApplicationName('Testing…