Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Zend/tests/gh23896.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--TEST--
GH-23896 (Assertion failure in zend_call_function() when the error handler throws during parent:: callable resolution)
--FILE--
<?php
set_error_handler(function ($severity, $m) {
throw new Exception($m, $severity);
});
spl_autoload_register(function ($class) {
if ($class === 'Loader') {
throw new Exception("Cannot load $class");
}
});
class P {}
class C extends P {
public function u(string $s) {
return unserialize($s);
}
}
foreach (['parent::my_unserialize', 'Loader::load'] as $callback) {
ini_set('unserialize_callback_func', $callback);
try {
(new C)->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
6 changes: 6 additions & 0 deletions Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,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);
Expand Down
4 changes: 1 addition & 3 deletions ext/xsl/tests/throw_in_autoload.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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===