#50690 [Opn->Fbk]: putenv() does not assign values to env. vars when the value is one character
ID: 50690
Updated by: jani@php.net
Reported By: php at keithtyler dot com
-Status: Open
+Status: Feedback
Bug Type: PHP options/info functions
Operating System: Windows XP
PHP Version: 5.3.1
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
It's either fixed or win32 only issue since I can't reproduce this
under linux using latest SVN checkout.
Previous Comments:
------------------------------------------------------------------------
[2010-01-08 01:35:52] php at keithtyler dot com
Description:
------------
In PHP 5.3.1, a putenv() call with a one character value does not
assign the value to the variable -- however it does create the
variable.
It doesn't matter what type of character it is (alpha, numeric, or
other).
A workaround is to add a space character before or after the value,
e.g.:
putenv("bar= x");
putenv("bar=x ");
(...as long as this space does not cause problems for the consumers of
the variable as it will be part of the string value.)
Reproduce code:
---------------
<?php
putenv("foo=ab");
putenv("bar=c");
var_dump(getenv("foo"));
var_dump(getenv("bar"));
var_dump(getenv("thisvardoesnotexist"));
?>
Expected result:
----------------
We would expect the output to be:
string(2) "ab"
string(1) "c"
bool(false)
which it does under PHP 5.3.0.
Actual result:
--------------
string(2) "ab"
string(0) ""
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50690&edit=1
Thread (5 messages)