diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 03b55c3eac06a..fd1baa7b7227a 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -164,11 +164,6 @@ static php_process_env _php_array_to_envp(zval *environment) ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(environment), key, element) { str = zval_get_string(element); - if (ZSTR_LEN(str) == 0) { - zend_string_release_ex(str, 0); - continue; - } - sizeenv += ZSTR_LEN(str) + 1; if (key && ZSTR_LEN(key)) { diff --git a/ext/standard/tests/general_functions/bug71868.inc b/ext/standard/tests/general_functions/bug71868.inc new file mode 100644 index 0000000000000..76b0cb0d70eff --- /dev/null +++ b/ext/standard/tests/general_functions/bug71868.inc @@ -0,0 +1,4 @@ + diff --git a/ext/standard/tests/general_functions/bug71868.phpt b/ext/standard/tests/general_functions/bug71868.phpt new file mode 100644 index 0000000000000..04068ea10e081 --- /dev/null +++ b/ext/standard/tests/general_functions/bug71868.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #71868: Environment variables with no value are filtered out by proc_open() +--SKIPIF-- + +--FILE-- + ''); + +$process = proc_open($cmd, $descriptors, $pipes, $cwd, $env); +proc_close($process); +?> +--EXPECT-- +bool(true) +string(0) ""