Don't check "fake" closures (fix assertion)

Fixes oss-fuzz #53078
This commit is contained in:
Dmitry Stogov 2022-11-07 12:19:54 +03:00
parent de4b502fef
commit 05b63b1593
3 changed files with 20 additions and 4 deletions

View file

@ -0,0 +1,16 @@
--TEST--
First class callables and &__call()
--FILE--
<?php
class Foo {
public function &__call($method, $args) {
return $method;
}
}
$foo = new Foo;
$bar = $foo->bar(...);
echo $bar(),"\n";
?>
--EXPECT--
bar

View file

@ -4166,7 +4166,7 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL,OBSERVER))
}
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
if (!EG(exception) && call->func && !(call->func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE)) {
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}

View file

@ -1845,7 +1845,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
}
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
if (!EG(exception) && call->func && !(call->func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE)) {
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}
@ -1954,7 +1954,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
}
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
if (!EG(exception) && call->func && !(call->func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE)) {
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}
@ -2064,7 +2064,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_OBS
}
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
if (!EG(exception) && call->func && !(call->func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE)) {
if (should_throw) {
zend_internal_call_arginfo_violation(call->func);
}