Bug #72369 [Opn->Asn]: array_merge() produces references in PHP7

From: Date: Thu, 09 Jun 2016 11:35:16 +0000
Subject: Bug #72369 [Opn->Asn]: array_merge() produces references in PHP7
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201514@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72369&edit=1

 ID:                 72369
 Updated by:         tony2001@php.net
 Reported by:        tony2001@php.net
 Summary:            array_merge() produces references in PHP7
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            Arrays related
 Operating System:   *
 PHP Version:        7.0.8RC1
-Assigned To:        
+Assigned To:        dmitry
 Block user comment: N
 Private report:     N



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)

« previous php.bugs (#201514) next »