Bug #70344 [NEW]: extract skips valid variable names

From: Date: Mon, 24 Aug 2015 14:36:30 +0000
Subject: Bug #70344 [NEW]: extract skips valid variable names
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195478@lists.php.net to get a copy of this message
From: danack Operating system: N/A PHP version: Irrelevant Package: Scripting Engine problem Bug Type: Bug Bug description:extract skips valid variable names Description: ------------ The extract function skips setting variables that have names that are valid but cannot be written as a simple variable. For example, anything with dots can be written and accessed as a variable like: ${'some.config.setting'} = 'foo'; var_dump(${'some.config.setting'}); But extract considers anything with a dot in to be an invalid variable name, and so skips doing: extract(['some.config.setting'} => 'foo']); fails to extract it. Test script: --------------- $values = [ 'value.with.dot' => 'set from array', ]; extract($values); if (!isset(${'value.with.dot'})) { echo "It's not set\n"; } else { var_dump(${'value.with.dot'}); } ${'value.with.dot'} = "It is a valid variable name, just not one that can be written as a non-interpolated variable."; var_dump(${'value.with.dot'}); Expected result: ---------------- string(14) "set from array" Actual result: -------------- It's not set -- Edit bug report at https://bugs.php.net/bug.php?id=70344&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70344&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70344&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70344&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70344&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70344&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70344&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70344&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70344&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70344&r=support Expected behavior: https://bugs.php.net/fix.php?id=70344&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70344&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70344&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70344&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70344&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70344&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70344&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70344&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70344&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70344&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70344&r=mysqlcfg

« previous php.bugs (#195478) next »