#30888 [NEW]: wrong access to global arrays

From: Date: Wed, 24 Nov 2004 21:00:16 +0000
Subject: #30888 [NEW]: wrong access to global arrays
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69421@lists.php.net to get a copy of this message
From: bugz at nagash dot org Operating system: FreeBSD \ Linux \ windows PHP version: 5.0.2 PHP Bug Type: Zend Engine 2 problem Bug description: wrong access to global arrays Description: ------------ don't work in the class - but if I do the same action NOT IN THE CLASS METHOD - it works <form action="test.php" method="post"> <input type="text" name="name" /> <input type="submit" /> </form> <?php error_reporting (E_ALL); if (!empty($_POST['name'])) { $z = '_POST'; echo ${$z}['name']; } ?> this works fine Reproduce code: --------------- <form action="test.php" method="post"> <input type="text" name="name" /> <input type="submit" /> </form> <?php error_reporting (E_ALL); if (!empty($_POST['name'])) { class blah { function tester () { $z = '_POST'; echo ${$z}['name']; } } $a = new blah; $a->tester(); } ?> Expected result: ---------------- the value I wrote in the form Actual result: -------------- Notice: Undefined variable: _POST in /home/nagash/www/test.php on line 11 -- Edit bug report at http://bugs.php.net/?id=30888&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30888&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30888&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30888&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30888&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30888&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30888&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30888&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30888&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30888&r=support Expected behavior: http://bugs.php.net/fix.php?id=30888&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30888&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30888&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30888&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30888&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30888&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30888&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30888&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30888&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30888&r=mysqlcfg

« previous php.bugs (#69421) next »