php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #14734 new superglobals ($_SERVER, etc.) not documented
Submitted: 2001-12-28 09:31 UTC Modified: 2002-03-11 20:56 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: abraham_guyt at bigfoot dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.1.0 OS: Win XP
Private report: No CVE-ID: None
 [2001-12-28 09:31 UTC] abraham_guyt at bigfoot dot com
When using PHP with track_vars On and register_globals Off (recommended setting), PHP doesn't know the built-in system and environment vars anymore.

For example, $PHP_SELF becomes and unknow variable.

This is really annoying.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-28 09:34 UTC] rasmus@php.net
Then don't turn register_globals off.  Turning off register_globals gets rid of all the globals.  If you still want some, leave it turned on, but simply set your variables_order directive in your php.ini file to reflect which globals you want.  For example, if you want environment and server variables, set it to "ES"
 [2001-12-28 09:56 UTC] mfischer@php.net
The correct way would be to use $_SERVER['PHP_SELF'] ; this is guaranteed to work with and without register_globals = off.
 [2001-12-28 10:01 UTC] abraham_guyt at bigfoot dot com
Hi All,

Thanks for the replies. The docs tell me that using globally registered vars presents a security risk and is being turned off in future versions anyway, so it's quite necessary to get accustomed to it.

Using $_SERVER['PHP_SELF'] must be the way to go.

However, where to find proper documentation on these 'new' vars ? I can't find them, only some pages mentioning they exist.. 
 [2001-12-28 10:05 UTC] mfischer@php.net
Valid point. I'm reopening this as a documentation problem.
 [2001-12-28 10:17 UTC] goba@php.net
Just a note: in the PHP 4.1.0 phpinfo() output, all the
predefined vars are printed as _SERVER and _ENV members,
except PHP_SELF, it is printed alone, and not in any
array. This must be corrected!
 [2001-12-28 10:29 UTC] mfischer@php.net
It's printed in _SERVER too (apache 1.3.22/php 4.1.0).
 [2001-12-28 11:35 UTC] goba@php.net
Tested again. Yes you are right. It would be good
to have it listed only in _SERVER, as the other vars.
 [2002-01-04 01:16 UTC] imajes@php.net
but $PHP_SELF is also a special variable, so I think also listing it out of any collection is a good thing.

 [2002-03-11 20:56 UTC] torben@php.net
This has been fixed in CVS.

FWIW, I think that if $PHP_SELF is to be documented outside
of the $_SERVER list, it should be worded carefully
to prevent users wondering why $PHP_SELF isn't available in 
the global scope.


Torben
 [2002-03-11 20:56 UTC] torben@php.net
This has been fixed in CVS.

FWIW, I think that if $PHP_SELF is to be documented outside
of the $_SERVER list, it should be worded carefully
to prevent users wondering why $PHP_SELF isn't available in 
the global scope.


Torben
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Aug 19 23:01:28 2024 UTC