From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.2.0
PHP Bug Type:     Variables related
Bug description:  Variable superglobal variable not recognised within function and 
method

Hello :-)

The definition of a variable variable as superglobal works fine when put
in the main coding (i.e. not within a function or method). Example:

<?php 

$aVariable = 'GET'; 
echo ${"_{$aVariable}"}; 

?> 

The system output is: Array

In the next example however, where the same code is put into a function,
the resulting output is a error message instead:

<?php 

function aFunction() 
{ 
   $aVariable = 'GET'; 
   echo ${"_{$aVariable}"}; 
} 
aFunction(); 

?> 

The system output is: Notice: Undefined variable: _GET in Bestand.php on
line 6.

Also when $_GET has been defined as global (which should not be necessary)
this malfunction remains.

Suggested intermediate solution:

<?php 

function aFunction() 
{ 
   $aVariable = 'GET'; 
   echo $GLOBALS["_{$aVariable}"]; 
} 
aFunction();

?>
-- 
Edit bug report at http://bugs.php.net/?id=17017&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=17017&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=17017&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=17017&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=17017&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17017&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=17017&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=17017&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=17017&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=17017&r=globals

Reply via email to