Bug #70910 [NEW]: extract() breaks variable references

From: Date: Fri, 13 Nov 2015 10:57:49 +0000
Subject: Bug #70910 [NEW]: extract() breaks variable references
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197225@lists.php.net to get a copy of this message
From: php at maisqi dot com Operating system: Windows 8 PHP version: 7.0.0RC7 Package: Scripting Engine problem Bug Type: Bug Bug description:extract() breaks variable references Description: ------------ extract() sets the values of variables that reference variables, instead of changing the variables that they point to. For example, say $ref is a reference to $var; if extract() has a "ref" var to inject in the current scope, it changes $ref and does nothing to $var -- it breaks the reference. NOTE: My tests was on PHP 7RC7 64 bits on Windows, though this probably isn't relevant. Test script: --------------- <?php $var = 'original value'; $ref =& $var; $hash = ['var' => 'new value']; extract($hash); echo 'ref: ', $ref, ' var: ', $var; Expected result: ---------------- ref: new value var: new value (This is what happens on PHP 5.6/64 bits) Actual result: -------------- ref: original value var: new value -- Edit bug report at https://bugs.php.net/bug.php?id=70910&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70910&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70910&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70910&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70910&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70910&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70910&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70910&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70910&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70910&r=support Expected behavior: https://bugs.php.net/fix.php?id=70910&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70910&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70910&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70910&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70910&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70910&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70910&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70910&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70910&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70910&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70910&r=mysqlcfg

« previous php.bugs (#197225) next »