Skip to content

Commit b074c5c

Browse files
committed
reflection: Remove dead code
Since the executor needs to be active at this point, the only way you could get an UNDEF return value is by having an exception. Therefore, `!EG(exception)` is always false. The check doesn't make sense, remove it.
1 parent 71d11bd commit b074c5c

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

ext/reflection/php_reflection.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,12 +2141,6 @@ ZEND_METHOD(ReflectionFunction, invoke)
21412141

21422142
zend_call_known_fcc(&fcc, &retval, num_args, params, named_params);
21432143

2144-
if (Z_TYPE(retval) == IS_UNDEF && !EG(exception)) {
2145-
zend_throw_exception_ex(reflection_exception_ptr, 0,
2146-
"Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
2147-
RETURN_THROWS();
2148-
}
2149-
21502144
if (Z_ISREF(retval)) {
21512145
zend_unwrap_reference(&retval);
21522146
}
@@ -2180,12 +2174,6 @@ ZEND_METHOD(ReflectionFunction, invokeArgs)
21802174

21812175
zend_call_known_fcc(&fcc, &retval, /* num_params */ 0, /* params */ NULL, params);
21822176

2183-
if (Z_TYPE(retval) == IS_UNDEF && !EG(exception)) {
2184-
zend_throw_exception_ex(reflection_exception_ptr, 0,
2185-
"Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
2186-
RETURN_THROWS();
2187-
}
2188-
21892177
if (Z_ISREF(retval)) {
21902178
zend_unwrap_reference(&retval);
21912179
}
@@ -3496,12 +3484,6 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
34963484
callback = _copy_function(mptr);
34973485
zend_call_known_function(callback, (object ? Z_OBJ_P(object) : NULL), intern->ce, &retval, argc, params, named_params);
34983486

3499-
if (Z_TYPE(retval) == IS_UNDEF && !EG(exception)) {
3500-
zend_throw_exception_ex(reflection_exception_ptr, 0,
3501-
"Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
3502-
RETURN_THROWS();
3503-
}
3504-
35053487
if (Z_ISREF(retval)) {
35063488
zend_unwrap_reference(&retval);
35073489
}

0 commit comments

Comments
 (0)