Hi
On Tue, 11 Apr 2006 15:27:39 +0200 Sebastian Mendel lists@sebastianmendel.de wrote:
Michal Čihař schrieb:
On Tue, 11 Apr 2006 14:45:28 +0200 Sebastian Mendel lists@sebastianmendel.de wrote:
the reason why i dropped check for $_SERVER/$_ENV was i thoguth there is no need for this function-call-overhead for checking this arrays - as normally getenv() should always work.
getenv can not work when something is _only_ a server variable but not in environment.
What do you exactly mean with 'server' and 'environment'?
no $_SERVER variable is in $_ENV
and variable not in _ENV is not returned by getenv.
Just try this code:
foreach($_SERVER as $key => $val) { if ($val != getenv($key)) { echo "$key differs from _SERVER\n"; echo "$key = $val / " . getenv($key) . "\n"; } } foreach($_ENV as $key => $val) { if ($val != getenv($key)) { echo "$key differs from _ENV\n"; echo "$key = $val / " . getenv($key) . "\n"; } }
Most likely some variables from _SERVER are not available throught getenv:
PHP_SELF differs from _SERVER PHP_SELF = test.php / SCRIPT_NAME differs from _SERVER SCRIPT_NAME = test.php / SCRIPT_FILENAME differs from _SERVER SCRIPT_FILENAME = test.php / PATH_TRANSLATED differs from _SERVER PATH_TRANSLATED = test.php / REQUEST_TIME differs from _SERVER REQUEST_TIME = 1144763136 /
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Michal ?iha? schrieb:
Hi
On Tue, 11 Apr 2006 15:27:39 +0200 Sebastian Mendel lists@sebastianmendel.de wrote:
Michal ?iha? schrieb:
On Tue, 11 Apr 2006 14:45:28 +0200 Sebastian Mendel lists@sebastianmendel.de wrote:
the reason why i dropped check for $_SERVER/$_ENV was i thoguth there is no need for this function-call-overhead for checking this arrays - as normally getenv() should always work.
getenv can not work when something is _only_ a server variable but not in environment.
What do you exactly mean with 'server' and 'environment'?
no $_SERVER variable is in $_ENV
and variable not in _ENV is not returned by getenv.
Just try this code:
foreach($_SERVER as $key => $val) { if ($val != getenv($key)) { echo "$key differs from _SERVER\n"; echo "$key = $val / " . getenv($key) . "\n"; } } foreach($_ENV as $key => $val) { if ($val != getenv($key)) { echo "$key differs from _ENV\n"; echo "$key = $val / " . getenv($key) . "\n"; } }
Most likely some variables from _SERVER are not available throught getenv:
SCRIPT_NAME differs from _SERVER SCRIPT_NAME = test.php / SCRIPT_FILENAME differs from _SERVER SCRIPT_FILENAME = test.php /
this booth works for me with getenv() (egual in getenv() end $_SERVER),
wired
PHP_* seems clear, as they are not really 'environment' variables
- -- Sebastian Mendel
www.sebastianmendel.de