Bug #72369 [Asn->Csd]: array_merge() produces references in PHP7
Edit report at https://bugs.php.net/bug.php?id=72369&edit=1
ID: 72369
Updated by: dmitry@php.net
Reported by: tony2001@php.net
Summary: array_merge() produces references in PHP7
-Status: Assigned
+Status: Closed
Type: Bug
Package: Arrays related
Operating System: *
PHP Version: 7.0.8RC1
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=bfcf32237e32b46cba7ce2f9bcd36482978f8dd8
Log: Fixed bug #72369 (array_merge() produces references in PHP7)
Previous Comments:
------------------------------------------------------------------------
[2016-06-09 11:34:58] tony2001@php.net
Description:
------------
array_merge() changed behavior in PHP7, the reproduce script below produces references, which it
didn't do in PHP5.
Test script:
---------------
<?php
$x = 'xxx';
$d = ['test' => &$x];
unset($x);
$a = ['test' => 'yyy'];
$a = array_merge($a, $d);
debug_zval_dump($a);
?>
Expected result:
----------------
array(1) refcount(2){
["test"]=>
string(3) "xxx" refcount(2)
}
Actual result:
--------------
array(1) refcount(2){
["test"]=>
&string(3) "xxx" refcount(1)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72369&edit=1
Thread (3 messages)