From:             copraonu at hotmail dot com
Operating system: Win32
PHP version:      4.3.2
PHP Bug Type:     Variables related
Bug description:  $$var doesn't work with $var="GLOBALS";

Description:
------------
I needed to get a variable's or array's value when i had it's name stored
in another variable. To get it, i used $$var_name; it all functioned as
expected until it came across with $GLOBALS


Reproduce code:
---------------
//doesn't work, gets nothing:
$var = "GLOBALS";
$var = $$var;
print_r($var);

//does work: prints $GLOBALS
gettype($GLOBALS);
$var = "GLOBALS";
$var = $$var;
print_r($var);


Expected result:
----------------
i expected output exactly like print_r($GLOBALS)'s

Actual result:
--------------
but got nothing.
I managed to get wanted result when i added
  gettype($GLOBALS);
before the code;

-- 
Edit bug report at http://bugs.php.net/?id=24598&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24598&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24598&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24598&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24598&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24598&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24598&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24598&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24598&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24598&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24598&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24598&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24598&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24598&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24598&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24598&r=gnused

Reply via email to