#46786 [NEW]: numeric variable & get_defined_vars()'s return come's something not expect.
| From: | caoxingk at gmail dot com | Date: | Sat, 06 Dec 2008 17:50:48 +0000 |
| Subject: | #46786 [NEW]: numeric variable & get_defined_vars()'s return come's something not expect. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-131689@lists.php.net to get a copy of this message | ||
From: caoxingk at gmail dot com
Operating system: win_nt
PHP version: 5.2.7
PHP Bug Type: Unknown/Other Function
Bug description: numeric variable & get_defined_vars()'s return come's something not
expect.
Description:
------------
<pre>
file NumericVarName.php
<?php
$TestVar = 8888;
$$TestVar = 'See the KEY\'s type...';
$SeeThis = get_defined_vars();
function MyEcho($_Msg) {echo '<script>alert(\'' . $_Msg .
'\');</script>';}
isset($$TestVar) && MyEcho('Case A!');
isset($SeeThis[8888]) && MyEcho('Case B!');
isset($SeeThis['8888']) && MyEcho('Case C!');
foreach ($SeeThis as $_Ui => $_Uk) {
($_Ui === 8888) && $_Temp = 'Case B too!';
($_Ui === '8888') && $_Temp = 'Case C too!';
isset($_Temp) && MyEcho($_Temp);
}
?>
------------------------------------------------------------------------------
My English is poor.Just explain my question shortly:
The output contains "Case A!" & "Case C too!",
but why not contain "Case C!" before "Case C too!" ?
------------------------------------------------------------------------------
Hope you can analyse what I've talk about,
maybe something not expect comes such as:
- syntax-parser do not check "$$var" when "$var" is numeric.
- do "foreach array" with get_defined_vars()'s return has a shortcoming.
- ...
Wish PHP better & better...
</pre>
--
Edit bug report at http://bugs.php.net/?id=46786&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46786&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46786&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46786&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46786&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46786&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46786&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46786&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46786&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46786&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46786&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46786&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46786&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46786&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46786&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46786&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46786&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46786&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46786&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46786&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46786&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46786&r=mysqlcfg