Skip to content
Merged
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
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ PHP NEWS
list of candidate encodings (with 200,000+ entries). (Jordi Kroon)
. mbregex has been deprecated. (youkidearitai)

- PCNTL:
. pcntl_exec() now throws a ValueError if the $args array is not a list
array. (Weilin Du)

- Mysqli:
. Added mysqli_quote_string() and mysqli::quote_string(). (Kamil Tekiela)

Expand Down
2 changes: 2 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ PHP 8.6 UPGRADE NOTES
- PCNTL:
. pcntl_alarm() now raises a ValueError if the seconds argument is
lower than zero or greater than platform's UINT_MAX.
. pcntl_exec() now raises a ValueError if the $args argument is not a list
array.

- PCRE:
. preg_grep() now returns false instead of a partial array when a PCRE
Expand Down
6 changes: 5 additions & 1 deletion ext/pcntl/pcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,11 @@ PHP_FUNCTION(pcntl_exec)
ZEND_PARSE_PARAMETERS_END();

if (args != NULL) {
// TODO Check array is a list?
if (!zend_array_is_list(Z_ARRVAL_P(args))) {
zend_argument_value_error(2, "must be a list array");
RETURN_THROWS();
}

/* Build argument list */
SEPARATE_ARRAY(args);
const HashTable *args_ht = Z_ARRVAL_P(args);
Expand Down
14 changes: 14 additions & 0 deletions ext/pcntl/tests/pcntl_exec_list_args.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
pcntl_exec(): Argument array must be a list
--EXTENSIONS--
pcntl
--FILE--
<?php
try {
pcntl_exec('cmd', ['opt' => '-n']);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
ValueError: pcntl_exec(): Argument #2 ($args) must be a list array
Loading