Bug #72779 [Nab]: Passing an array by reference creates references of its values

From: Date: Mon, 08 Aug 2016 10:18:33 +0000
Subject: Bug #72779 [Nab]: Passing an array by reference creates references of its values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203073@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 Updated by: cmb@php.net Reported by: lars dot schultz at toolpark dot com Summary: Passing an array by reference creates references of its values Status: Not a bug Type: Bug Package: Variables related Operating System: Linux PHP Version: 7.0.9 Assigned To: cmb Block user comment: N Private report: N New Comment: It appears to me that the commit that fixed this issue was <http://git.php.net/?p=php-src.git;a=commit;h=7989db9>. There is alread a PHPT[1] attached, so we do have a regression test already. [1] <http://qa.php.net/write-test.php> Previous Comments: ------------------------------------------------------------------------ [2016-08-08 10:01:09] lars dot schultz at toolpark dot com Well...it used to be one. I couldn't find a matching Bug-Report. If it wasn't caught by a test, maybe one should be added? not sure how tests work in PHP though. ------------------------------------------------------------------------ [2016-08-08 09:56:04] cmb@php.net So this is not a bug. :-) ------------------------------------------------------------------------ [2016-08-08 07:36:34] lars dot schultz at toolpark dot com 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#203073) next »