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 could not be added to the previous docker-based test matrix. CI now uses shivammathur/setup-php for all PHP versions (7.2–8.6) in a single matrix, replacing the docker-based setup. 8.6 is built from php-src master and marked continue-on-error since it is still in development and is a moving target. The package.xml validation previously run in ci/test_inner.sh is preserved as a pecl package step, and the now-unused ci/ docker scripts are removed.

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.

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>

@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?

Comment thread .github/workflows/main.yml Outdated
# 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.

@rlerdorf rlerdorf Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right. Dropped continue-on-error. The 8.6 job will now show a real (red) failure when php-src master breaks something, while fail-fast: false keeps it from cancelling the other versions.

@rlerdorf

rlerdorf commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Consolidated everything onto shivammathur/setup-php in a single 7.2–8.6 matrix and dropped the docker-based setup. The package.xml check that ci/test_inner.sh did is preserved as a pecl package step, and the now-unused ci/ scripts are removed. 8.6 builds from php-src master so it's marked continue-on-error.

Test 7.2 through 8.6 with a single shivammathur/setup-php matrix instead of the
docker-image based setup, which had no published php:8.6 image. 8.6 is built
from php-src master; fail-fast is disabled so a failure there does not cancel
the other versions.

The package.xml validation previously done in ci/test_inner.sh is kept as a
"pecl package" step. The now-unused ci/ docker scripts are removed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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