ID:               30888
 Updated by:       [EMAIL PROTECTED]
 Reported By:      bugz at nagash dot org
-Status:           Closed
+Status:           Bogus
 Bug Type:         Zend Engine 2 problem
-Operating System: FreeBSD \ Linux \ windows
+Operating System: FreeBSD  Linux  windows
 PHP Version:      5.0.2
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You can not use the superglobals with variable-variables.


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

[2004-11-24 22:10:39] bugz at nagash dot org

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

------------------------------------------------------------------------

[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