|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-08-12 17:02 UTC] bugs dot php dot net at ss dot st dot tc
-Summary: extract() turns array array elements to references
+Summary: extract() turns array elements to references
[2015-08-12 17:02 UTC] bugs dot php dot net at ss dot st dot tc
[2015-08-13 05:38 UTC] laruence@php.net
[2015-08-13 05:38 UTC] laruence@php.net
-Status: Open
+Status: Closed
[2015-08-18 16:24 UTC] ab@php.net
[2016-07-20 11:37 UTC] davey@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 05:00:01 2025 UTC |
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 }