Skip to content

fix: support packed arrays on PHP 8.6 - #393

Merged
realFlowControl merged 2 commits into
developfrom
florian/php-8.6-packed-arrays
Aug 5, 2026
Merged

fix: support packed arrays on PHP 8.6#393
realFlowControl merged 2 commits into
developfrom
florian/php-8.6-packed-arrays

Conversation

@realFlowControl

@realFlowControl realFlowControl commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What and why

PHP 8.6 changed HT_PACKED_SIZE from a macro to an inline function in php/php-src#22305. parallel used #ifdef HT_PACKED_SIZE around its packed-array copy and destruction paths, so those paths were silently compiled out on PHP 8.6. Packed zvals were then interpreted as Bucket structures, causing invalid string-key pointers and segmentation faults when transferring packed arrays between runtimes.

Implementation

Replace the three #ifdef HT_PACKED_SIZE checks with #if PHP_VERSION_ID >= 80200 around persistent copying, thread-local copying, and destruction of packed arrays. PHP 8.0 and 8.1 use the older HashTable representation without arPacked, 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.

@realFlowControl
realFlowControl force-pushed the florian/php-8.6-packed-arrays branch from d036a5b to c6fa6ca Compare August 5, 2026 11:57
@realFlowControl
realFlowControl marked this pull request as ready for review August 5, 2026 12:02
@realFlowControl realFlowControl changed the title Support packed arrays on PHP 8.6 fix: support packed arrays on PHP 8.6 Aug 5, 2026
@realFlowControl
realFlowControl merged commit 4dc9153 into develop Aug 5, 2026
101 of 106 checks passed
@realFlowControl
realFlowControl deleted the florian/php-8.6-packed-arrays branch August 5, 2026 12:11
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