From 39ff9ec3ec73e38027fd7e2b486d39e4f98c3ca6 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Thu, 4 Feb 2010 09:08:57 +0000 Subject: [PATCH] - #50690, putenv does assign value when their length is one char on windows --- ext/standard/basic_functions.c | 2 +- ext/standard/tests/general_functions/bug50690.phpt | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 ext/standard/tests/general_functions/bug50690.phpt diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index c3693f74b8..5c2c23e5b0 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4056,7 +4056,7 @@ PHP_FUNCTION(putenv) 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*/ diff --git a/ext/standard/tests/general_functions/bug50690.phpt b/ext/standard/tests/general_functions/bug50690.phpt new file mode 100644 index 0000000000..4d9f0dc5ee --- /dev/null +++ b/ext/standard/tests/general_functions/bug50690.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #23650 (putenv() does not assign values when the value is one character) +--FILE-- + +--EXPECT-- +string(2) "ab" +string(1) "c" +bool(false) -- 2.50.1