summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/proc_open.c3
-rw-r--r--ext/standard/tests/general_functions/proc_open_array.phpt24
2 files changed, 16 insertions, 11 deletions
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 85bd2c9f57..3871dcc201 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -401,8 +401,7 @@ static zend_string *get_valid_arg_string(zval *zv, int elem_num) {
}
if (strlen(ZSTR_VAL(str)) != ZSTR_LEN(str)) {
- php_error_docref(NULL, E_WARNING,
- "Command array element %d contains a null byte", elem_num);
+ zend_value_error("Command array element %d contains a null byte", elem_num);
zend_string_release(str);
return NULL;
}
diff --git a/ext/standard/tests/general_functions/proc_open_array.phpt b/ext/standard/tests/general_functions/proc_open_array.phpt
index 99e1cc56cb..b2ab4d8c9f 100644
--- a/ext/standard/tests/general_functions/proc_open_array.phpt
+++ b/ext/standard/tests/general_functions/proc_open_array.phpt
@@ -17,11 +17,19 @@ try {
echo $exception->getMessage() . "\n";
}
-echo "\nNul byte in program name:";
-var_dump(proc_open(["php\0oops"], $ds, $pipes));
+echo "\nNul byte in program name:\n";
+try {
+ proc_open(["php\0oops"], $ds, $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-echo "\nNul byte in argument:";
-var_dump(proc_open(["php", "arg\0oops"], $ds, $pipes));
+echo "\nNul byte in argument:\n";
+try {
+ proc_open(["php", "arg\0oops"], $ds, $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "\nBasic usage:\n";
$proc = proc_open([$php, '-r', 'echo "Hello World!\n";'], $ds, $pipes);
@@ -58,17 +66,15 @@ fpassthru($pipes[1]);
proc_close($proc);
?>
---EXPECTF--
+--EXPECT--
Empty command array:
Command array must have at least one element
Nul byte in program name:
-Warning: proc_open(): Command array element 1 contains a null byte in %s on line %d
-bool(false)
+Command array element 1 contains a null byte
Nul byte in argument:
-Warning: proc_open(): Command array element 2 contains a null byte in %s on line %d
-bool(false)
+Command array element 2 contains a null byte
Basic usage:
Hello World!