pajoye                                   Sun, 24 Jan 2010 13:49:47 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=293902

Log:
- #50690, putenv does assign value when their length is one char

Bug: http://bugs.php.net/50690 (Assigned) putenv() does not assign values to 
env. vars when the value is one character
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
    A   
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt
    U   php/php-src/trunk/ext/standard/basic_functions.c
    A   php/php-src/trunk/ext/standard/tests/general_functions/bug50690.phpt

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-01-24 
13:36:08 UTC (rev 293901)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-01-24 
13:49:47 UTC (rev 293902)
@@ -4056,7 +4056,7 @@
                pe.key_len = strlen(pe.key);
 #ifdef PHP_WIN32
                if (equals) {
-                       if (pe.key_len < setting_len - 2) {
+                       if (pe.key_len < setting_len - 1) {
                                value = p + 1;
                        } else {
                                /* empty string*/

Added: 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt
===================================================================
--- 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt 
                            (rev 0)
+++ 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt 
    2010-01-24 13:49:47 UTC (rev 293902)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #23650 (putenv() does not assign values when the value is one character)
+--FILE--
+<?php
+putenv("foo=ab");
+putenv("bar=c");
+var_dump(getenv("foo"));
+var_dump(getenv("bar"));
+var_dump(getenv("thisvardoesnotexist"));
+?>
+--EXPECT--
+string(2) "ab"
+string(1) "c"
+bool(false)

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===================================================================
--- php/php-src/trunk/ext/standard/basic_functions.c    2010-01-24 13:36:08 UTC 
(rev 293901)
+++ php/php-src/trunk/ext/standard/basic_functions.c    2010-01-24 13:49:47 UTC 
(rev 293902)
@@ -4043,7 +4043,7 @@

 #ifdef PHP_WIN32
                if (equals) {
-                       if (pe.key_len < setting_len - 2) {
+                       if (pe.key_len < setting_len - 1) {
                                value = p + 1;
                        } else {
                                /* empty string*/

Added: php/php-src/trunk/ext/standard/tests/general_functions/bug50690.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/bug50690.phpt        
                        (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/bug50690.phpt        
2010-01-24 13:49:47 UTC (rev 293902)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #23650 (putenv() does not assign values when the value is one character)
+--FILE--
+<?php
+putenv("foo=ab");
+putenv("bar=c");
+var_dump(getenv("foo"));
+var_dump(getenv("bar"));
+var_dump(getenv("thisvardoesnotexist"));
+?>
+--EXPECT--
+string(2) "ab"
+string(1) "c"
+bool(false)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to