ID:               30888
 User updated by:  bugz at nagash dot org
 Reported By:      bugz at nagash dot org
-Status:           Open
+Status:           Closed
 Bug Type:         Zend Engine 2 problem
 Operating System: FreeBSD \ Linux \ windows
 PHP Version:      5.0.2
 New Comment:

sorry.
http://ru2.php.net/en/language.variables.predefined
Variable variables: Superglobals cannot be used as variable variables
inside functions or class methods.


Previous Comments:
------------------------------------------------------------------------

[2004-11-24 22:00:14] bugz at nagash dot org

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 this bug report at http://bugs.php.net/?id=30888&edit=1

Reply via email to