Bug #70144 [Ver]: Assigning value to uninitialized byref array keys changed array order with PHP 7
| From: | laruence@php.net | Date: | Mon, 27 Jul 2015 03:12:24 +0000 |
| Subject: | Bug #70144 [Ver]: Assigning value to uninitialized byref array keys changed array order with PHP 7 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194742@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70144&edit=1
ID: 70144
Updated by: laruence@php.net
Reported by: admin at angosso dot net
Summary: Assigning value to uninitialized byref array keys
changed array order with PHP 7
Status: Verified
Type: Bug
Package: Scripting Engine problem
Operating System: Linux, Windows, Mac
PHP Version: 7.0.0beta2
Block user comment: N
Private report: N
New Comment:
this is a side affects by the new AST based compiler.
previously, we fetch_dim_w b first, then fetch_dim_w a
but now we always evaluate the expr from left to right.
so, basically, I don't think here is something need to be fixed.
Previous Comments:
------------------------------------------------------------------------
[2015-07-27 01:05:44] requinix@php.net
http://3v4l.org/cmaYm
------------------------------------------------------------------------
[2015-07-27 00:23:43] admin at angosso dot net
Description:
------------
The Elements of the code or object properties will be created automatically for the server [dot] in
reference and assignment for bug.
Test script:
---------------
$array = [];
$array["a"] =& $array["b"];
$array["b"] = 1;
var_dump($array);
now results in the array ["a" => 1, "b" => 1], while previously the
result
was ["b" => 1, "a" => 1];
Expected result:
----------------
/rfc/uniform_variable_syntax
/rfc/abstract_syntax_tree
Stack trace:
#0 file.php(4): foo(42)
#1 {main}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70144&edit=1