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
1
vote
2 answers

Warning: Creating default object from empty value (typical solution not solving issue)

NOTE: I've read the other topics on stackoverflow about how to solve this issue: Creating default object from empty value in PHP? For some reason I still get the Warning message: Creating default object from empty value I've tried a few things to…
JMC
  • 1,700
  • 7
  • 25
  • 34
1
vote
0 answers

How to resend android push notification first try failed

I have this methode : $oAndroidService = new GoogleGNCService($message); # divide per batch with 1000 users $a_batch = array_chunk($a_users, 1000); for($i = 0; $i < count($a_batch); $i++){ # get the liste of tokens …
user7424312
  • 137
  • 3
  • 10
1
vote
1 answer

Simple PHP routing with undefined url for php7 and lower

Trying to use this php routing class on a server with php 5.4 version installed. this code works but won't be good for undefined URLs. it also has a comment line ($k[$_GET['p']] ?? $k[''])(); with the correct code behavior for php7, which makes the…
LowMatic
  • 223
  • 2
  • 13
1
vote
1 answer

Pear Package Language Detect Cannot Detect English on PHP 7

I tried this package http://pear.php.net/package/Text_LanguageDetect/ It's pretty accurate on PHP 5.4. But I failed on PHP 7. Any idea why? Script I run:
Hao
  • 6,291
  • 9
  • 39
  • 88
1
vote
0 answers

How to update from php 5.4.x to php 5.5 on ubuntu 12.10

I tried to update my php from 5.4.x to 5.5.x with this link. But it did not work. my system claimed nothing to update and everything is newest. Could someone help me???
Haruji Burke
  • 449
  • 1
  • 4
  • 17
1
vote
1 answer

Design Tests for PHP 5.3/5.4 up to 7 with phpunit

Is there any way of configuring a php project so that its phpunit test cases can be executed on (PHP 5.3), PHP 5.4, PHP 5.5, PHP 5.6 and PHP 7? I came across this issue, when I've set the phpunit require-dev dependency in my project to 5.4, while I…
white_gecko
  • 4,808
  • 4
  • 55
  • 76
1
vote
1 answer

Get start date by week and year

I have a question. I want to get the first datetime by week number and year. It's possibile ? I try : date('Y-m-d H:i:s', strtotime("$weak_number week")). The idea is to get the datetime of monday for this week. Thx in advance, and sorry for my…
Harea Costicla
  • 797
  • 3
  • 9
  • 20
1
vote
1 answer

Database test faillure with dbUnit

I'm trying to execute some databasetests with php unit but I keep getting the following errors: My composer.json look like this: { "require": { "phpunit/phpunit": "4.8", "phpunit/dbunit": "^2.0" } This is the page I'm trying to perform…
Frank W.
  • 777
  • 3
  • 14
  • 33
1
vote
0 answers

Using curl from command line works, but not when executing it in PHP (CURLE_RECV_ERROR 56)

this is a curl command that works fine from command line: curl "myUrl" -H "Host: myHost.com" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0" -H "Accept:…
Boy
  • 1,182
  • 2
  • 11
  • 28
1
vote
1 answer

mysqlnd driver has only one api extension (pdo_mysql)

After checking phpinfo() I saw that mysqlnd driver installed on linux (php 5.4) has only one API extension (pdo_mysql), but I also want to be able to work with mysqli. How do I associate mysqlnd driver with mysqli extension? I guess I can fix this…
Boy
  • 1,182
  • 2
  • 11
  • 28
1
vote
1 answer

Mkdir in php set wrong permission

I have the following code : if (!file_exists('/public_html/'.'classic/'.'test'.'/')) { if(!mkdir('/public_html/'.'classic/'.'test'.'/', 0777, true)) { return false; } } This create only the folder /classic witch have the…
Harea Costicla
  • 797
  • 3
  • 9
  • 20
1
vote
1 answer

Show an image from an ubuntu server

I have a problem on my side. So I created a script that upload resize and upload files on a server : /tmp/117x117/6.jpg. In the template I have : I look in the source of…
Harea Costicla
  • 797
  • 3
  • 9
  • 20
1
vote
1 answer

Sorting in Multi Dimension array in php

When I am adding same unit of number in "num". eg(0-9). It is sorting my array. But if any of the "num" value contains a different unit of digits, the sorting fails. eg(4,7,2,1) this will work. (7,12,76,2) this will fail. $stack =…
Tanuj
  • 567
  • 6
  • 12
1
vote
1 answer

error_reporting bool operations

In https://stackoverflow.com/a/2867082/288568 I found two ways of disabling notices. So what exactly is the a difference between error_reporting(E_ALL ^ E_NOTICE); and error_reporting(E_ALL & ~E_NOTICE); ? And what does the following line…
Alex
  • 32,506
  • 16
  • 106
  • 171
1
vote
1 answer

Set a session variables using twig

I have a question. I have a route on my site where I put in session an variable like this: public function userCaptcha(){ $_SESSION['isFacebookRegistration'] = 0; } Now I have another route witch render a view : public function index(){ …
TanGio
  • 766
  • 2
  • 12
  • 34