[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
| From: | David Carlier | Date: | Wed, 30 Sep 2026 04:23:50 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141753@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-09-30T05:23:12+01:00
Commit: https://github.com/php/php-src/commit/e6775b3fcc759831c61c71bad6bcb26dc312a5c4
Raw diff: https://github.com/php/php-src/commit/e6775b3fcc759831c61c71bad6bcb26dc312a5c4.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix GH-23896: Assertion failure in zend_call_function() after a throwing deprecation
Changed paths:
A Zend/tests/gh23896.phpt
M Zend/zend_execute_API.c
M ext/xsl/tests/throw_in_autoload.phpt
Diff:
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--
+<?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
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 0014cfce2d27..076471c4e65a 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -836,6 +836,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===