[edit - added a possible workaround]
header('Content-Type: text/plain'); class i { public static function __callStatic( $method, $args) { switch( $method ) { case 'GLOBALS': $var =& $GLOBALS; break; case '_SERVER': $var =& $_SERVER; break; case '_GET': $var =& $_GET; break;
[original answer] This is strange. I agree that this could be a PHP error. However, superglobal does work, not as a variable.
<?php header('Content-Type: text/plain'); $method = '_SERVER'; var_dump($$method); // Works fine class i { public static function __callStatic( $method, $args) { var_dump( $_SERVER ); // works var_dump( $$method ); // Notice: Undefined variable: _SERVER } } i::_SERVER();
source share