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
7
votes
2 answers

Line breaks in PHP xmlwriter document

I've got an XML feed I've created using XMLWriter. It works flawlessly in dev on a PHP 5.6 vagrant box. On the live server, running PHP 5.4 the feed fails to render with a message: This page contains the following errors: error on line 3 at column…
user101289
  • 9,888
  • 15
  • 81
  • 148
7
votes
1 answer

How to configure a server to send email using cPanel?

I am trying to send email using php. The mail is returning true. But I am receiving the email. So I am guessing that maybe there is some problem with the server. Is there any tutorial explaining how to configure the server to properly send email…
odbhut.shei.chhele
  • 5,834
  • 16
  • 69
  • 109
7
votes
1 answer

Where can I find the bcompiler dll for xampp 1.8.2(PHP 5.4.X)

I am using xampp 1.8.2 on windows xp and bcompiler dll is not present in the ext directory. I installed older xampp(1.7.1) on windows XP and bcompiler dll was included in the ext directory. where can I find the bcompiler dll for xampp 1.8.2(PHP…
rakeshjain
  • 1,791
  • 11
  • 11
7
votes
7 answers

Find second and fourth saturday's of the month

How to find 2nd and 4th Saturday of the month. I wrote these lines:- echo "may 2nd sat ".date('d', strtotime('may 2013 second saturday')); echo '
may 4th sat '.date('d', strtotime('may 2013 fourth saturday')); …
Maulik patel
  • 1,551
  • 8
  • 22
  • 44
7
votes
1 answer

Is it safe to call foreach on empty php arrays in PHP 5.4?

As i remember, before i always had to check count($array) before making a foreach. From that times i always make this doublecheck, and wanted to know, does it make sense nowdays with php 5.4? I've set error_reporting to E_ALL and executed following…
avasin
  • 9,186
  • 18
  • 80
  • 127
6
votes
1 answer

PHP crypt() returns *0 failure string in version 5.6.4, but not 5.4,

echo crypt('test', "$2a$07$"); produces a long hash in PHP version 5.4.16, but it produces the "failure string" *0 in 5.6.4. Reading the PHP docs on crypt(), I'm still not quite clear why, though the Changelog mentions the *1 being returned instead…
user49438
  • 889
  • 7
  • 20
6
votes
1 answer

How to import static function with namespace in php?

class A declared at namespace1. namesapce namesapce1; class A { public static function fun1() { } } I want to use fun1() inside class B: namespace namesapce2; use ???? as fun1 class B { public static func2() { fun1(); …
david
  • 161
  • 3
  • 9
6
votes
3 answers

Custom DQL functions in doctrine2

How do you use custom DQL functions in partials to hydrate query result. Looking for a way to use DQL functions in createQuery or any other doctrine way (nativeSql, QueryBuilder) its not necessary to use partials but it should hydrate my array based…
hardik
  • 9,141
  • 7
  • 32
  • 48
6
votes
2 answers

flashMessenger not working when adding Message after a long request

I'm facing a really strange issue with Zend Frameworks flashMessenger and can't find out what's the cause of the problem, nor how to solve it. When a requested action takes very long, the flashMessenger doesn't work as expected. Non-working…
Kaii
  • 20,122
  • 3
  • 38
  • 60
6
votes
2 answers

How to get osCommerce 2.2 running on PHP 5.4?

I recently upgraded PHP to 5.4 and after adding some tweaks now the old osCommerce installation of a customer with lots of customisations is running again, but there is still a problem: if you put an item in your cart the cart stays empty How can I…
rubo77
  • 19,527
  • 31
  • 134
  • 226
6
votes
3 answers

PHP: how to check if an object's properties have values?

I use this to check if an object has properties, function objectHasProperty($input){ return (is_object($input) && (count(get_object_vars($input)) > 0)) ? true : false; } But then I want to check further to make sure all properties have…
Run
  • 54,938
  • 169
  • 450
  • 748
6
votes
3 answers

Why do I get a different result from two supposedly analogous arithmetic operations?

In the following code, why is the multiplication approach not producing rounding errors, while the cumulative addition approach is? function get_value() { return 26.82; } function a($quantity) { $value_excluding_vat = get_value(); …
Alex
  • 3,029
  • 3
  • 23
  • 46
6
votes
3 answers

Opcache - Clean cache in PHP5.4 and lower

Is there a way to clean/reset the cached files using Opcache with PHP5.4 or lower? Here is the opcache_reset() function which just seems to work with PHP5.5 A workaround was to reboot... Edit: I opened an issue on Github
schickling
  • 4,000
  • 4
  • 29
  • 33
6
votes
2 answers

Can I instantiate an exception without throwing it?

I am using a SaaS error and exception logging service called Rollbar. In my code, I have a Rollbar static object that I can use to report exceptions to the service. For example: try { ... throw new SomeException(); ... } catch…
Alex
  • 3,029
  • 3
  • 23
  • 46
6
votes
11 answers

PHP 5.4 multipart/form-data UTF-8 encoding

I'm having problem with UTF-8 encoding while posting form data as "multipart/form-data", without multipart/form-data everything works well. But since I have to upload files on same post, I need to use multipart/form-data. Problem started after…
she hates me
  • 1,212
  • 5
  • 25
  • 44
1
2
3
26 27