Bug #72779 [Opn->Csd]: Passing an array by reference creates references of its values
| From: | lars dot schultz at toolpark dot com | Date: | Mon, 08 Aug 2016 07:36:35 +0000 |
| Subject: | Bug #72779 [Opn->Csd]: Passing an array by reference creates references of its values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203054@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72779&edit=1
ID: 72779
User updated by: lars dot schultz at toolpark dot com
Reported by: lars dot schultz at toolpark dot com
Summary: Passing an array by reference creates references of
its values
-Status: Open
+Status: Closed
Type: Bug
Package: Variables related
Operating System: Linux
-PHP Version: 7.0.9
+PHP Version: 7.0.3
Block user comment: N
Private report: N
New Comment:
sorry, had no opportunity to test it on other versions...or rather: did not know that I had the
opportunity to test it on other versions. Sorry for the bother and thanks for the hint.
Previous Comments:
------------------------------------------------------------------------
[2016-08-08 07:28:46] laruence@php.net
according to https://3v4l.org/i74nS
this bug should be fixed already
------------------------------------------------------------------------
[2016-08-08 07:18:55] lars dot schultz at toolpark dot com
Description:
------------
PHP Version 7.0.3-1~dotdeb+8.1
Passing the content of an array by reference, replaces the content with a reference to it.
Getting expected behaviour in the following Versions:
PHP Version 5.3.3-7+squeeze23
PHP Version 5.4.45
Test script:
---------------
function sub(&$data){}
$data = array();
sub($data['nested']);
echo serialize(array($data,$data));
Expected result:
----------------
a:2:{i:0;a:1:{s:6:"nested";N;}i:1;a:1:{s:6:"nested";N;}}
Actual result:
--------------
a:2:{i:0;a:1:{s:6:"nested";N;}i:1;a:1:{s:6:"nested";R:3;}}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72779&edit=1