Bug #73686 [Ver->Csd]: Adding settype()ed values to ArrayObject results in references.

From: Date: Fri, 09 Dec 2016 03:42:39 +0000
Subject: Bug #73686 [Ver->Csd]: Adding settype()ed values to ArrayObject results in references.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205868@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73686&edit=1 ID: 73686 Updated by: laruence@php.net Reported by: arjen at parse dot nl Summary: Adding settype()ed values to ArrayObject results in references. -Status: Verified +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: All PHP Version: 7.1.0 Assigned To: dmitry Block user comment: N Private report: N New Comment: Automatic comment on behalf of laruence@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=68bdd6d0182efb58b975ce7057ea895e1de46697 Log: Fixed bug #73686 (Adding settype()ed values to ArrayObject results in references) Previous Comments: ------------------------------------------------------------------------ [2016-12-08 19:24:19] cmb@php.net Thanks for properly reporting this issue here, Arjen! Apparently, this bug has been introduced with commit eaf489ac[1]. Dmitry, could you please have a look at this issue? [1] <http://git.php.net/?p=php-src.git;a=commit;h=eaf489ac> ------------------------------------------------------------------------ [2016-12-08 13:37:25] arjen at parse dot nl Description: ------------ Found at https://twitter.com/kozzi11/status/806828728890380288 https://3v4l.org/suHQh Removing the settype() call produces the expected output. Test script: --------------- <?php $ao = new ArrayObject; foreach ([1, 2, 3] as $i => $var) { settype($var, 'string'); $ao[$i] = $var; } var_dump($ao); Expected result: ---------------- Output for 5.6.0 - 5.6.28, hhvm-3.12.0 - 3.13.2, 7.0.0 - 7.0.14 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "3" } } Actual result: -------------- Output for 7.1.0 object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(3) { [0]=> &string(1) "3" [1]=> &string(1) "3" [2]=> &string(1) "3" } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73686&edit=1

« previous php.bugs (#205868) next »