Bug #70250 [NEW]: extract() turns array array elements to references

From: Date: Wed, 12 Aug 2015 16:58:16 +0000
Subject: Bug #70250 [NEW]: extract() turns array array elements to references
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195160@lists.php.net to get a copy of this message
From: bugs dot php dot net at ss dot st dot tc Operating system: Gentoo Linux PHP version: 7.0Git-2015-08-12 (Git) Package: Arrays related Bug Type: Bug Bug description:extract() turns array array elements to references 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 bug report at https://bugs.php.net/bug.php?id=70250&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70250&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70250&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70250&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70250&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70250&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70250&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70250&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70250&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70250&r=support Expected behavior: https://bugs.php.net/fix.php?id=70250&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70250&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70250&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70250&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70250&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70250&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70250&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70250&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70250&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70250&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70250&r=mysqlcfg

« previous php.bugs (#195160) next »