Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ PHP NEWS
(Weilin Du)
. getenv() and putenv() now raises a ValueError when the first argument
contains null bytes. (Weilin Du)
. proc_open() now raises a ValueError when the $cwd argument contains
null bytes. (Weilin Du)

- Streams:
. Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream
Expand Down
2 changes: 2 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ PHP 8.6 UPGRADE NOTES
argument value is passed.
. scandir() now raises a ValueError when an invalid $sorting_order
argument value is passed.
. proc_open() now raises a ValueError when the $cwd argument contains
null bytes.

- Zip:
. ZipArchive::extractTo now raises a TypeError for the
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/proc_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ PHP_FUNCTION(proc_open)
Z_PARAM_ARRAY_HT(descriptorspec)
Z_PARAM_ZVAL(pipes)
Z_PARAM_OPTIONAL
Z_PARAM_STRING_OR_NULL(cwd, cwd_len)
Z_PARAM_PATH_OR_NULL(cwd, cwd_len)
Z_PARAM_ARRAY_HT_OR_NULL(environment)
Z_PARAM_ARRAY_OR_NULL(other_options)
ZEND_PARSE_PARAMETERS_END();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
proc_open() rejects null bytes in cwd
--SKIPIF--
<?php
if (!function_exists("proc_open")) echo "skip proc_open() is not available";
?>
--FILE--
<?php

try {
proc_open("does_not_matter", [], $pipes, "foo\0bar");
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}

?>
--EXPECT--
proc_open(): Argument #4 ($cwd) must not contain any null bytes
Loading