Bug #70250 [Opn->Csd]: extract() turns array elements to references

From: Date: Thu, 13 Aug 2015 05:38:09 +0000
Subject: Bug #70250 [Opn->Csd]: extract() turns array elements to references
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195178@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70250&edit=1 ID: 70250 Updated by: laruence@php.net Reported by: bugs dot php dot net at ss dot st dot tc Summary: extract() turns array elements to references -Status: Open +Status: Closed Type: Bug Package: Arrays related Operating System: Gentoo Linux PHP Version: 7.0Git-2015-08-12 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of laruence Revision: http://git.php.net/?p=php-src.git;a=commit;h=dc5c6ab774ff4f52675a663cb241896ca5d804cf Log: Fixed bug #70250 (extract() turns array elements to references) Previous Comments: ------------------------------------------------------------------------ [2015-08-12 17:02:45] bugs dot php dot net at ss dot st dot tc (fixed typo in bug "Summary" field) ------------------------------------------------------------------------ [2015-08-12 16:58:14] bugs dot php dot net at ss dot st dot tc Description: ------------ extract() turns array elements back to references after they were once referenced and despite the reference was removed. Tested on PHP 5.6.12 (works as expected), 7.0b3 (buggy) and git rev 2366a070c8 (buggy). Test script: --------------- <?php $array = ['key' => 'value']; // create a reference to an element of the array $ref = & $array['key']; // make sure array element is a reference var_dump($array); // remove the $ref reference unset($ref); // make sure array elements are no longer references var_dump($array); extract($array); // make sure array elements are still no references var_dump($array); Expected result: ---------------- array(1) { ["key"]=> &string(5) "value" } array(1) { ["key"]=> string(5) "value" } array(1) { ["key"]=> string(5) "value" } Actual result: -------------- array(1) { ["key"]=> &string(5) "value" } array(1) { ["key"]=> string(5) "value" } array(1) { ["key"]=> &string(5) "value" <=== reference again } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70250&edit=1

« previous php.bugs (#195178) next »