Commit 359ce15176d for php
commit 359ce15176df8a115cf8bc99e9df46d4dd1fe13f
Author: ndossche <7771979+ndossche@users.noreply.github.com>
Date: Thu Oct 22 21:05:24 2026 +0200
zend_test: Backport zend_test_compile_to_ast() function
This was introduced in 8.5.
We need this in 8.4 too to debug AST dumping (see GH-24418).
diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c
index 42619c62602..09940e664e1 100644
--- a/ext/zend_test/test.c
+++ b/ext/zend_test/test.c
@@ -1792,6 +1792,28 @@ static PHP_FUNCTION(zend_test_create_throwing_resource)
ZVAL_RES(return_value, res);
}
+static PHP_FUNCTION(zend_test_compile_to_ast)
+{
+ zend_string *str;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STR(str)
+ ZEND_PARSE_PARAMETERS_END();
+
+ zend_arena *ast_arena;
+ zend_ast *ast = zend_compile_string_to_ast(str, &ast_arena, ZSTR_EMPTY_ALLOC());
+ if (!ast) {
+ RETURN_THROWS();
+ }
+
+ zend_string *result = zend_ast_export("", ast, "");
+
+ zend_ast_destroy(ast);
+ zend_arena_destroy(ast_arena);
+
+ RETVAL_STR(result);
+}
+
static PHP_FUNCTION(zend_test_gh18756)
{
ZEND_PARSE_PARAMETERS_NONE();
diff --git a/ext/zend_test/test.stub.php b/ext/zend_test/test.stub.php
index caf3fbac08e..6ea169d315b 100644
--- a/ext/zend_test/test.stub.php
+++ b/ext/zend_test/test.stub.php
@@ -330,6 +330,8 @@ function zend_test_is_zend_ptr(int $addr): bool {}
function zend_test_log_err_debug(string $str): void {}
+ function zend_test_compile_to_ast(string $str): string {}
+
function zend_test_gh18756(): void {}
/** @compile-time-eval */
diff --git a/ext/zend_test/test_arginfo.h b/ext/zend_test/test_arginfo.h
index 43f34748878..aa11ba1f77c 100644
Binary files a/ext/zend_test/test_arginfo.h and b/ext/zend_test/test_arginfo.h differ