From 583843e0afd2454d1ee2f2f8bda00916c6c8ec50 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Wed, 17 Jun 2026 09:49:11 -0400 Subject: [PATCH 1/2] Support PHP 8.6 Add compatibility shims in php_ast.h for the internal Zend API changes in PHP 8.6 (8.6.0-dev): - ZEND_AST_METHOD_REFERENCE was renamed to ZEND_AST_TRAIT_METHOD_REFERENCE - The _throw() ZPP variants were removed; plain ZPP now always throws, so zend_parse_parameters_throw maps to zend_parse_parameters and the removed ZEND_PARSE_PARAMS_THROW flag is defined to 0 (the throwing default). All guarded on PHP_VERSION_ID >= 80600, so older versions are unaffected and the userland ast\AST_METHOD_REFERENCE constant is unchanged. Also add tests/php86_param_doc_comments.phpt covering the one new 8.6 language feature that affects the AST: doc comments on function parameters. The docComment child of AST_PARAM (previously always null) is now populated by the parser, matching ReflectionParameter::getDocComment(). No extension changes are required for it. Co-Authored-By: Claude Opus 4.8 --- php_ast.h | 9 +++ tests/php86_param_doc_comments.phpt | 105 ++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 tests/php86_param_doc_comments.phpt diff --git a/php_ast.h b/php_ast.h index efecc21..06756ed 100644 --- a/php_ast.h +++ b/php_ast.h @@ -99,6 +99,15 @@ extern ast_str_globals str_globals; # define ZEND_AST_CLONE 0x1fc #endif +#if PHP_VERSION_ID >= 80600 +/* ZEND_AST_METHOD_REFERENCE was renamed to ZEND_AST_TRAIT_METHOD_REFERENCE. */ +# define ZEND_AST_METHOD_REFERENCE ZEND_AST_TRAIT_METHOD_REFERENCE +/* The _throw() ZPP variants were removed; plain ZPP now always throws. + * ZEND_PARSE_PARAMS_THROW is gone, so a flag of 0 yields the throwing default. */ +# define ZEND_PARSE_PARAMS_THROW 0 +# define zend_parse_parameters_throw zend_parse_parameters +#endif + /* Pretend it still exists */ # define ZEND_AST_LIST ((1 << (ZEND_AST_IS_LIST_SHIFT + 1)) - 1) diff --git a/tests/php86_param_doc_comments.phpt b/tests/php86_param_doc_comments.phpt new file mode 100644 index 0000000..ae11fd1 --- /dev/null +++ b/tests/php86_param_doc_comments.phpt @@ -0,0 +1,105 @@ +--TEST-- +Doc comments on function/method parameters (PHP 8.6+) +--SKIPIF-- +=8.6 only'); ?> +--FILE-- +p = $value; } + } +} +PHP; + +echo ast_dump(ast\parse_code($code, $version=120)), "\n"; +--EXPECT-- +AST_STMT_LIST + 0: AST_FUNC_DECL + name: "f" + docComment: null + params: AST_PARAM_LIST + 0: AST_PARAM + type: AST_TYPE + flags: TYPE_LONG (4) + name: "a" + default: null + attributes: null + docComment: "/** doc for $a */" + hooks: null + 1: AST_PARAM + type: null + name: "b" + default: null + attributes: null + docComment: null + hooks: null + 2: AST_PARAM + type: AST_TYPE + flags: TYPE_STRING (6) + name: "c" + default: "x" + attributes: null + docComment: "/** doc for $c */" + hooks: null + stmts: AST_STMT_LIST + returnType: null + attributes: null + __declId: 0 + 1: AST_CLASS + name: "C" + docComment: null + extends: null + implements: null + stmts: AST_STMT_LIST + 0: AST_PROP_GROUP + flags: MODIFIER_PUBLIC (1) + type: AST_TYPE + flags: TYPE_STRING (6) + props: AST_PROP_DECL + 0: AST_PROP_ELEM + name: "p" + default: null + docComment: null + hooks: AST_STMT_LIST + 0: AST_PROPERTY_HOOK + name: "set" + docComment: null + params: AST_PARAM_LIST + 0: AST_PARAM + type: AST_TYPE + flags: TYPE_STRING (6) + name: "value" + default: null + attributes: null + docComment: "/** doc for $value */" + hooks: null + stmts: AST_STMT_LIST + 0: AST_ASSIGN + var: AST_PROP + expr: AST_VAR + name: "this" + prop: "p" + expr: AST_VAR + name: "value" + attributes: null + __declId: 1 + attributes: null + attributes: null + type: null + __declId: 2 From 2d4ada28a06ef4703cb63b3059bcf54f594e9fd6 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Wed, 17 Jun 2026 10:17:54 -0400 Subject: [PATCH 2/2] CI: test against PHP 8.6 via setup-php nightly There is no published php:8.6 docker image yet, so 8.6 cannot be added to the existing docker-based test matrix. Add a separate job using shivammathur/setup-php, which provides an 8.6 build compiled from php-src master. The job is marked continue-on-error since 8.6 is still in development and is a moving target. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ce5c28..91ab771 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,3 +45,32 @@ jobs: # Runs a single command using the runners shell - name: Build and test in docker run: bash ci/test_dockerized.sh ${{ matrix.PHP_VERSION }} + + # PHP 8.6 has no published `php:8.6` docker image yet, so it cannot be tested + # via the docker matrix above. Use setup-php's nightly build (compiled from + # php-src master) instead. This is allowed to fail since 8.6 is still in + # development. + build-nightly: + runs-on: ubuntu-latest + continue-on-error: true + + strategy: + fail-fast: false + matrix: + include: + - PHP_VERSION: '8.6' + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.PHP_VERSION }} + + - name: Build and test + run: | + phpize + EXTRA_CFLAGS='-Wall -Wextra -Wno-unused-parameter' ./configure + make -j2 + NO_INTERACTION=1 REPORT_EXIT_STATUS=1 make test TESTS="--show-diff"