php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23675 Autoglobals are not accessible through a variable variable
Submitted: 2003-05-17 19:45 UTC Modified: 2003-05-18 03:02 UTC
From: vma1 at abv dot bg Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5CVS-2003-05-17 (dev) OS: Slackware 9
Private report: No CVE-ID: None
 [2003-05-17 19:45 UTC] vma1 at abv dot bg
<?
	abc123 ();

	function abc123 ()
	{
		$name = "_SERVER";
		printf ("%s<br>", ${$name}["SERVER_NAME"]);
	}
?>

The _SERVER autoglobal array is not accessible through a variable variable. The above script gives the following error:

Notice: Undefined variable: _SERVER in /usr/local/apache/site/htdocs/zzz.php on line 7

When the _SERVER array is accessed directly (not through a variable variable) everything works correctly.
Here is the configure line:
./configure --with-pgsql --with-apache=../apache-1.3 --enable-track-vars --with-pfpro=/usr/local/src/payflowpro/linux --with-imap=/usr/local/src/imap-2003.DEV.SNAP-0304071905 --with-imap-ssl=/usr/include/openssl --without-pear

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-18 03:02 UTC] derick@php.net
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

Read from \"http://www.php.net/manual/en/language.variables.predefined.php#language.variables.predefined\"
(found by typing \"superglobals\" in our manual search box):

    Variable variables:  Superglobals cannot be used as variable variables.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC