Skip to content

Commit 27c6ee5

Browse files
committed
Fix options key validation
1 parent 25b1841 commit 27c6ee5

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Zend/tests/request_parse_body/multipart_options_invalid_key.phpt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ request_parse_body() invalid key
44
<?php
55

66
try {
7-
request_parse_body(options: [
8-
'foo' => 1,
9-
]);
7+
request_parse_body(options: ['foo' => 1]);
8+
} catch (Error $e) {
9+
echo $e->getMessage(), "\n";
10+
}
11+
12+
try {
13+
request_parse_body(options: ['moo' => 1]);
1014
} catch (Error $e) {
1115
echo $e->getMessage(), "\n";
1216
}
1317

1418
?>
1519
--EXPECT--
1620
Invalid key "foo" in $options argument
21+
Invalid key "moo" in $options argument

ext/standard/html.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,10 +1624,10 @@ static zend_result cache_request_parse_body_options(HashTable *options)
16241624
case 'U':
16251625
CHECK_OPTION(upload_max_filesize);
16261626
break;
1627-
default:
1628-
zend_value_error("Invalid key \"%s\" in $options argument", ZSTR_VAL(key));
1629-
return FAILURE;
16301627
}
1628+
1629+
zend_value_error("Invalid key \"%s\" in $options argument", ZSTR_VAL(key));
1630+
return FAILURE;
16311631
} ZEND_HASH_FOREACH_END();
16321632

16331633
#undef CACHE_OPTION

0 commit comments

Comments
 (0)