fix: support packed arrays on PHP 8.6 - #393
Merged
Merged
Conversation
realFlowControl
force-pushed
the
florian/php-8.6-packed-arrays
branch
from
August 5, 2026 11:57
d036a5b to
c6fa6ca
Compare
realFlowControl
marked this pull request as ready for review
August 5, 2026 12:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
PHP 8.6 changed
HT_PACKED_SIZEfrom a macro to an inline function in php/php-src#22305.parallelused#ifdef HT_PACKED_SIZEaround its packed-array copy and destruction paths, so those paths were silently compiled out on PHP 8.6. Packed zvals were then interpreted asBucketstructures, causing invalid string-key pointers and segmentation faults when transferring packed arrays between runtimes.Implementation
Replace the three
#ifdef HT_PACKED_SIZEchecks with#if PHP_VERSION_ID >= 80200around persistent copying, thread-local copying, and destruction of packed arrays. PHP 8.0 and 8.1 use the olderHashTablerepresentation withoutarPacked, PHP 8.2 through 8.5 expose the packed-array API as macros, while PHP 8.6 exposes it as inline functions.Add a regression that returns a packed array containing floats and an integer from a runtime.