}
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;
}
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);
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!