#15730 [Dup->Bgs]: Autoglobal (Variable) Variables within funktions.
| From: | sniper@php.net | Date: | Wed, 12 Mar 2003 01:05:17 +0000 |
| Subject: | #15730 [Dup->Bgs]: Autoglobal (Variable) Variables within funktions. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-35376@lists.php.net to get a copy of this message | ||
ID: 15730
Updated by: sniper@php.net
Reported By: postings dot php dot net at hans dot spath dot de
-Status: Duplicate
+Status: Bogus
-Bug Type: Scripting Engine problem
+Bug Type: Feature/Change Request
Operating System: Win2k
PHP Version: 4.1.1
New Comment:
Please read what I said in my previous comment and stop reopening these
reports.
Previous Comments:
------------------------------------------------------------------------
[2003-03-11 18:22:57] postings dot php dot net at hans dot spath dot de
*grrr* I'm browsing through my old bug reports and what must I see?
Some of them got Status "Bogus" instead of "Closed" or "Duplicate" ...
------------------------------------------------------------------------
[2002-06-18 19:27:32] sniper@php.net
As you've already done, just add your comments to the open report.
Thank you.
------------------------------------------------------------------------
[2002-03-01 12:13:22] sander@php.net
Duplicate of 15810... (that bug has more info than this one...)
------------------------------------------------------------------------
[2002-02-26 09:52:52] yohgaki@php.net
It seems PHP(Zend) is looking up local (active) symbol table, since
you are accessing via vairable variable.
Can we fix this?
------------------------------------------------------------------------
[2002-02-26 08:45:43] postings dot php dot net at hans dot spath dot de
I tried to access the autoglobal variables via the variable variables
'trick'. But that doesn't work within functions.
Examples:
That works:
<?
?><hr><?
$test1 = '_TEST';
$test2 = '_SERVER';
$_TEST = '[test1]';
?><pre><?
var_dump( $test1 );
var_dump( ${'_TEST'} );
var_dump( ${$test1} );
var_dump( ${"$test1"} );
?><hr><?
var_dump( $test2 );
var_dump( ${'_SERVER'} );
var_dump( ${$test2} );
var_dump( ${"$test2"} );
?></pre><hr><?
That doesn't work:
<?
function foolme()
{
?><hr><?
$test1 = '_TEST';
$test2 = '_SERVER';
$_TEST = '[test1]';
?><pre><?
var_dump( $test1 );
var_dump( ${'_TEST'} );
var_dump( ${$test1} );
var_dump( ${"$test1"} );
?><hr><?
var_dump( $test2 );
var_dump( ${'_SERVER'} );
var_dump( ${$test2} );
var_dump( ${"$test2"} );
?></pre><hr><?
}
foolme();
--
I found that, while writing a class for processing html forms:
function __wakeup() {
$method = $this->_method;
$this->_FORM = &${"_$method"};
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15730&edit=1