Skip to content

Commit 2984667

Browse files
committed
Throw an error if an empty string is passed to getParamater() or hasParameter()
1 parent bafb1ab commit 2984667

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ext/reflection/php_reflection.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,6 +2152,11 @@ ZEND_METHOD(ReflectionFunctionAbstract, hasParameter)
21522152
RETURN_FALSE;
21532153
}
21542154

2155+
if (ZSTR_LEN(arg_name) != 0) {
2156+
zend_argument_value_error(1, "must not be an empty string");
2157+
RETURN_THROWS();
2158+
}
2159+
21552160
if (arg_name != NULL) {
21562161
if (get_parameter_position(fptr, arg_name, num_args) > -1) {
21572162
RETURN_TRUE;
@@ -2197,6 +2202,11 @@ ZEND_METHOD(ReflectionFunctionAbstract, getParameter)
21972202
RETURN_THROWS();
21982203
}
21992204

2205+
if (ZSTR_LEN(arg_name) != 0) {
2206+
zend_argument_value_error(1, "must not be an empty string");
2207+
RETURN_THROWS();
2208+
}
2209+
22002210
if (arg_name != NULL) {
22012211
position = get_parameter_position(fptr, arg_name, num_args);
22022212

0 commit comments

Comments
 (0)