Skip to content

Support PHP 8.6#259

Open
rlerdorf wants to merge 2 commits into
nikic:masterfrom
rlerdorf:php86-support
Open

Support PHP 8.6#259
rlerdorf wants to merge 2 commits into
nikic:masterfrom
rlerdorf:php86-support

Conversation

@rlerdorf

@rlerdorf rlerdorf commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Support PHP 8.6

Add compatibility shims in php_ast.h for the internal Zend API changes in PHP 8.6:

  • 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.

New 8.6 feature: doc comments on parameters

Of the implemented PHP 8.6 RFCs, only Add DocComments for function parameters is a parser change that affects the AST; the rest are library functions, new built-in enums, and reflection/runtime/ini/stream changes that don't touch the parse tree.

AST_PARAM already has a docComment child (index 4), which was always null before 8.6. It is now populated by the parser for parameters carrying a doc comment, with no extension changes required. The output matches the engine's own ReflectionParameter::getDocComment() (including the before-vs-after-parameter comment behavior), and older AST versions are unaffected.

tests/php86_param_doc_comments.phpt is added as a version-gated regression test (skips on PHP < 8.6), covering doc comments on both function parameters and property-hook parameters.

CI

There is no published php:8.6 docker image yet, so 8.6 cannot be added to the existing docker-based test matrix. A separate build-nightly job is added using shivammathur/setup-php, which provides an 8.6 build compiled from php-src master. It is marked continue-on-error since 8.6 is still in development and is a moving target.

Testing

Built against PHP 8.6.0-dev and ran the full suite: 95 passed, 0 failed, 2 skipped (the skipped tests are version-gated). The build and existing tests continue to pass on earlier PHP versions.

rlerdorf and others added 2 commits June 17, 2026 09:49
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>

@nikic nikic left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, but I wonder if it wouldn't make sense to just use shivammathur/setup-php for all PHP versions, instead of having two different CI setups?

# development.
build-nightly:
runs-on: ubuntu-latest
continue-on-error: true

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to not continue on error. Better to ignore the error than not see it at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants