Skip to content

Prepare for PHP 8.6: drop removed internal APIs, add 8.6 build presets - #141

Open
CodeLieutenant wants to merge 1 commit into
trunkfrom
compat/php-8.6
Open

Prepare for PHP 8.6: drop removed internal APIs, add 8.6 build presets#141
CodeLieutenant wants to merge 1 commit into
trunkfrom
compat/php-8.6

Conversation

@CodeLieutenant

Copy link
Copy Markdown
Member

Checked php-src UPGRADING.INTERNALS against this codebase and fixed everything 8.6 breaks.

What changed

XtOffsetOf()offsetof()

The XtOffsetOf() alias of C's offsetof() macro has been removed. Use offsetof() directly.

101 call sites across src/ and include/ — every object-handler .offset assignment and every PHP_SCYLLADB_GET_* fetch macro. Also fixed tools/gen_descriptor/gen_class_descriptor.php, which would otherwise re-emit the removed macro into every *_descriptor.c on the next build.

zend_binary_zval_strcmp()zend_binary_strcmp()

The zend_binary_zval_strcmp() and zend_binary_zval_strncmp() functions have been removed, because they are unsafe by relying on the zvals having a specific type.

One site, src/Type/ValueHash.c. The enclosing switch (Z_TYPE_P(...)) already establishes IS_STRING, so the operands are unwrapped explicitly with Z_STRVAL_P/Z_STRLEN_P. No behaviour change.

--with-pic--enable-pic

--with-pic has been changed to --enable-pic; the old flag now errors.

scripts/compile-php.sh selects the flag by version, so -v 8.5 and -v 8.6 both work.

PHP 8.6 presets

PHP86 added to the PHPVersion enum in generate-presets.php; CMakePresets.json regenerated (+18 presets: 3 build types × 3 backends × ZTS/NTS).

Reviewer notes

  • No version guards. All three API changes are spelled the same way on 8.3–8.5 — XtOffsetOf was always just an alias, and zend_binary_strcmp has existed throughout — so there is no #ifdef PHP_VERSION_ID anywhere in this diff.
  • CMakePresets.json has unrelated churn. The committed file was already stale relative to its generator: it still carried PHP_DRIVER_STATIC / PHP_DRIVER_BACKEND, renamed to PHP_SCYLLADB_* in the generator some time ago. Regenerating picks that up (108 of the deleted lines). Pre-existing drift, not introduced here.
  • Not in scope. CLAUDE.md and .claude/skills/ still document XtOffsetOf as the canonical pattern in 9 places, and there is no CI matrix row for 8.6 yet. Both left for follow-ups.
  • Nothing else in UPGRADING.INTERNALS applies — the codebase has no zend_parse_parameters(), ZVAL_IS_NULL, INI_STR/INT/BOOL, zval_dtor, WRONG_PARAM_COUNT, Z_GC_*, Z_COPYABLE, EMPTY_SWITCH_DEFAULT_CASE, ZEND_RESULT_CODE, php_error_docref1/2, or underscore-prefixed stream calls. The ext/session, ext/uri, ext/xml, mysqlnd and intl changes don't touch us, and cmake/TargetOptimizations.cmake already passes -undefined dynamic_lookup on Darwin, matching the new libtool behaviour.

Verification

Built and tested against PHP 8.5 NTS debug (DebugPHP8.5NTS), since 8.6 isn't released yet — this PR is forward-compat only and cannot be end-to-end verified on 8.6 today.

  • cmake --build out/DebugPHP8.5NTS — clean, 228/228, no new warnings
  • pest --testsuite=Unit803 passed (12058 assertions), 27 skipped, 1 failed

The single failure is UuidTest > it produces unique UUIDs across separate processes, a known pre-existing cross-process environment issue on this machine, unrelated to these changes.

php-src master (8.6) removes several internal APIs this extension relies
on. None of the replacements are version-specific, so no PHP_VERSION_ID
guards are needed — the new spellings compile identically on 8.3-8.5.

- XtOffsetOf() -> offsetof(): the alias is gone in 8.6. 101 call sites
  across src/ and include/, plus the descriptor generator, which would
  otherwise re-emit the removed macro on the next build.
- zend_binary_zval_strcmp() -> zend_binary_strcmp() in ValueHash.c. It
  was removed as unsafe for relying on the zvals having a specific type;
  the enclosing switch already establishes IS_STRING, so the operands
  are unwrapped explicitly.
- compile-php.sh: --with-pic was renamed to --enable-pic and the old
  spelling now hard-errors, so the flag is selected by version.

Adds PHP 8.6 to the preset matrix (18 new presets). Regenerating
CMakePresets.json also picks up pre-existing drift: the committed file
still carried PHP_DRIVER_STATIC / PHP_DRIVER_BACKEND, which the
generator renamed to PHP_SCYLLADB_* some time ago.
@mergify

mergify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

1 participant