diff --git a/NEWS b/NEWS index 1de00a09ded0..9434f6a4cdbe 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,9 @@ PHP NEWS comparison. (Arnaud) . Fixed OSS-Fuzz #536440507 (Immutable class incorrect assertion). (ndossche) + . Fixed bug GH-23896 (Assertion failure in zend_call_function() when the + error handler throws while resolving a self::/parent::/static:: + callable). (Lazizbek Ergashev) - DOM: . Fixed use-after-free when re-constructing a DOMXPath whose php:function diff --git a/Zend/tests/gh23896.phpt b/Zend/tests/gh23896.phpt new file mode 100644 index 000000000000..1524bdb55161 --- /dev/null +++ b/Zend/tests/gh23896.phpt @@ -0,0 +1,33 @@ +--TEST-- +GH-23896 (Assertion failure in zend_call_function() when the error handler throws during parent:: callable resolution) +--FILE-- +u('O:3:"FOO":0:{}'); + } catch (Exception $e) { + echo $e->getMessage(), "\n"; + var_dump($e->getPrevious()); + } +} +?> +--EXPECT-- +Use of "parent" in callables is deprecated +NULL +Cannot load Loader +NULL diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 9ccb36a1e15a..95ff2e4f42fa 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -824,6 +824,12 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_ } if (!zend_is_callable_ex(&fci->function_name, fci->object, 0, NULL, fci_cache, &error)) { + if (EG(exception)) { + if (error) { + efree(error); + } + return SUCCESS; + } ZEND_ASSERT(error && "Should have error if not callable"); zend_string *callable_name = zend_get_callable_name_ex(&fci->function_name, fci->object); diff --git a/ext/xsl/tests/throw_in_autoload.phpt b/ext/xsl/tests/throw_in_autoload.phpt index 2df7d3690bed..90ab0098b8e4 100644 --- a/ext/xsl/tests/throw_in_autoload.phpt +++ b/ext/xsl/tests/throw_in_autoload.phpt @@ -28,14 +28,12 @@ $proc->registerPhpFunctions(); $xsl = $proc->importStylesheet($xsl); try { $newdom = $proc->transformToDoc($inputdom); -} catch (Error $e) { +} catch (Exception $e) { echo $e->getMessage(), "\n"; - echo $e->getPrevious()->getMessage(), "\n"; } ?> ===DONE=== --EXPECT-- string(4) "TeSt" -Invalid callback TeSt::dateLang, class "TeSt" not found Autoload exception ===DONE===