Bug? (_ENV in PHP v5.2.0)
| From: | Eli | Date: | Tue, 16 Jan 2007 04:14:38 +0000 |
| Subject: | Bug? (_ENV in PHP v5.2.0) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-247135@lists.php.net to get a copy of this message | ||
Hi,
System:
Win32
PHP 5.2.0
Apache 2.0.54 (PHP in CGI mode)
CGI vars are not automatically loaded into $_ENV global array. Only when calling getenv('var'), just then the variable appears in $_ENV.
Besides, it seems that the env vars are loaded automatically into $_SERVER. And $HTTP_ENV_VARS is always NULL.
<?php
echo "before getenv...";
echo "<br>\$_ENV: "; var_dump($_ENV);
echo "<br>\$HTTP_ENV_VARS: "; var_dump($HTTP_ENV_VARS);
getenv('SERVER_PROTOCOL');
echo "<hr>after getenv...";
echo "<br>\$_ENV: "; var_dump($_ENV);
echo "<br>\$HTTP_ENV_VARS: "; var_dump($HTTP_ENV_VARS);
?>
=== output:
before getenv...
$_ENV: array(0) { }
$HTTP_ENV_VARS: NULL
--------------------------------------------------------------------------------
after getenv...
$_ENV: array(1) { ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" }
$HTTP_ENV_VARS: NULL
Is it a bug? Or this is the way it should work?
-thanks, Eli