Doc #73207 [Ver->Ana]: Array ordering is same between 5.6.21 and 7.1.0 RC3

From: Date: Fri, 30 Sep 2016 10:48:22 +0000
Subject: Doc #73207 [Ver->Ana]: Array ordering is same between 5.6.21 and 7.1.0 RC3
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13968@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73207&edit=1 ID: 73207 Updated by: cmb@php.net Reported by: tuyen-truong at cybozu dot vn Summary: Array ordering is same between 5.6.21 and 7.1.0 RC3 -Status: Verified +Status: Analyzed Type: Documentation Problem Package: Arrays related PHP Version: 7.1.0RC3 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Okay; I think that a respective note in UPGRADING is appropriate. FTR: see bug #71539. Previous Comments: ------------------------------------------------------------------------ [2016-09-30 10:41:12] nikic@php.net The change is intentional. We found that we cannot support the evaluation order in PHP 7.0 in a way that is memory-safe in certain edge-cases, so we had to go back to the previous ordering. (However, evaluation of side-effects will still occur in left-to-right order.) ------------------------------------------------------------------------ [2016-09-30 09:57:48] cmb@php.net Indeed, the behavior changed again as of PHP 7.1.0beta1, see <https://3v4l.org/BPNL3>. Not sure if that is a bug or rather a documentation issue. ------------------------------------------------------------------------ [2016-09-30 09:33:38] yohgaki@php.net Behavior changed between 7.1.0 alpha3 and 7.1.0 beta1. https://3v4l.org/TiMHY ------------------------------------------------------------------------ [2016-09-30 08:40:29] tuyen-truong at cybozu dot vn Description: ------------ As description at http://php.net/manual/en/migration70.incompatible.php The "Array ordering when elements are automatically created during by reference assignments has changed" is written. And there is no other description about array ordering in http://php.net/manual/en/migration71.incompatible.php But, when I have confirmed the result, I saw that the output of php5.6.21 and php7.1.0RC3 are same. I think that it is bug of PHP7.1.0RC3, but please confirm it is a bug or not. Thank you. Test script: --------------- 1. php56.exe -r "$array = []; $array['a'] =& $array['b']; $array['b'] = 1; var_dump($array);" Output: array(2) { ["b"]=> &int(1) ["a"]=> &int(1) } 2. // php7.0.6 php70.exe -r "$array = []; $array['a'] =& $array['b']; $array['b'] = 1; var_dump($array);" Output: array(2) { ["a"]=> &int(1) ["b"]=> &int(1) } 3. php71.exe -r "$array = []; $array['a'] =& $array['b']; $array['b'] = 1; var_dump($array);" Output: array(2) { ["b"]=> &int(1) ["a"]=> &int(1) } Expected result: ---------------- When executing this script 3. php71.exe -r "$array = []; $array['a'] =& $array['b']; $array['b'] = 1; var_dump($array);" The output will be same the output of php7.0.6 array(2) { ["a"]=> &int(1) ["b"]=> &int(1) } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73207&edit=1

« previous php.doc.bugs (#13968) next »