Skip to content

Commit 684a2ff

Browse files
committed
init
1 parent 334287d commit 684a2ff

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ PHP NEWS
189189
(Weilin Du)
190190
. getenv() and putenv() now raises a ValueError when the first argument
191191
contains null bytes. (Weilin Du)
192+
. parse_str() now raises a ValueError when the $string argument contains
193+
null bytes. (Weilin Du)
192194
. proc_open() now raises a ValueError when the $cwd argument contains
193195
null bytes. (Weilin Du)
194196

UPGRADING

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ PHP 8.6 UPGRADE NOTES
9797
argument value is passed.
9898
. getenv() and putenv() now raises a ValueError when the first argument
9999
contains null bytes.
100+
. parse_str() now raises a ValueError when the $string argument contains
101+
null bytes.
100102
. linkinfo() now raises a ValueError when the $path argument is empty.
101103
. pathinfo() now raises a ValueError when an invalid $flag
102104
argument value is passed.

ext/standard/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5012,7 +5012,7 @@ PHP_FUNCTION(parse_str)
50125012
size_t arglen;
50135013

50145014
ZEND_PARSE_PARAMETERS_START(2, 2)
5015-
Z_PARAM_STRING(arg, arglen)
5015+
Z_PARAM_PATH(arg, arglen)
50165016
Z_PARAM_ZVAL(arrayArg)
50175017
ZEND_PARSE_PARAMETERS_END();
50185018

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
parse_str() rejects null bytes
3+
--FILE--
4+
<?php
5+
6+
try {
7+
parse_str("a=1\0&b=2", $result);
8+
} catch (ValueError $e) {
9+
echo $e->getMessage(), "\n";
10+
}
11+
12+
?>
13+
--EXPECT--
14+
parse_str(): Argument #1 ($string) must not contain any null bytes

0 commit comments

Comments
 (0)