[php-src] PHP-8.4: Fix AST printing of interface extends list as implements
| From: | Jorg Sowa | Date: | Wed, 04 Nov 2026 23:34:52 +0000 |
| Subject: | [php-src] PHP-8.4: Fix AST printing of interface extends list as implements | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143335@lists.php.net to get a copy of this message | ||
Author: Jorg Sowa (jorgsowa)
Date: 2026-11-05T00:20:51+01:00
Commit: https://github.com/php/php-src/commit/b4fb1d71704441c90705069088ddf1760912529a
Raw diff: https://github.com/php/php-src/commit/b4fb1d71704441c90705069088ddf1760912529a.diff
Fix AST printing of interface extends list as implements
Closes GH-25064
Changed paths:
A Zend/tests/assert/expect_interface_extends.phpt
M NEWS
M Zend/zend_ast.c
Diff:
diff --git a/NEWS b/NEWS
index 578709a0a5db..0e2a521673f0 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.4.29
+- Core:
+ . Fixed AST printing of interface extends list as implements. (Jorg Sowa)
+
- Curl:
. Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire)
diff --git a/Zend/tests/assert/expect_interface_extends.phpt
b/Zend/tests/assert/expect_interface_extends.phpt
new file mode 100644
index 000000000000..61775ffb9c21
--- /dev/null
+++ b/Zend/tests/assert/expect_interface_extends.phpt
@@ -0,0 +1,22 @@
+--TEST--
+AST printing of interface extends list
+--INI--
+zend.assertions=1
+--FILE--
+<?php
+
+try {
+ assert(false && function () {
+ interface I extends A, B {}
+ });
+} catch (AssertionError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+assert(false && function () {
+ interface I extends A, B {
+ }
+
+})
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index e0606dbb0419..eec705588a13 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -1669,7 +1669,7 @@ static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str,
zend_ast_d
zend_ast_export_ns_name(str, decl->child[0], 0, indent);
}
if (decl->child[1]) {
- smart_str_appends(str, " implements ");
+ smart_str_appends(str, (decl->flags & ZEND_ACC_INTERFACE) ? " extends " : "
implements ");
zend_ast_export_ex(str, decl->child[1], 0, indent);
}
smart_str_appends(str, " {\n");