From 2236506b998fe5112f325a78ee727f3c491ff84d Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Wed, 5 Aug 2026 13:42:52 +0200 Subject: [PATCH 1/2] Add packed array return regression --- tests/base/075.phpt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/base/075.phpt diff --git a/tests/base/075.phpt b/tests/base/075.phpt new file mode 100644 index 0000000..82429e9 --- /dev/null +++ b/tests/base/075.phpt @@ -0,0 +1,23 @@ +--TEST-- +Copy packed array return value +--SKIPIF-- + +--FILE-- +run(static fn() => [1.1, 2.2, 3.3, 4])->value()); +?> +--EXPECT-- +array(4) { + [0]=> + float(1.1) + [1]=> + float(2.2) + [2]=> + float(3.3) + [3]=> + int(4) +} From c6fa6ca8a74dbb7e3a5cd821e38162cc40b30f67 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Wed, 5 Aug 2026 13:44:22 +0200 Subject: [PATCH 2/2] Support packed arrays on PHP 8.6 --- src/copy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/copy.c b/src/copy.c index 042fabf..9f1115c 100644 --- a/src/copy.c +++ b/src/copy.c @@ -220,7 +220,7 @@ static zend_always_inline HashTable *php_parallel_copy_hash_persistent_inline( return ht; } -#ifdef HT_PACKED_SIZE +#if PHP_VERSION_ID >= 80200 // if array is packed, copy it as packed if (HT_IS_PACKED(ht)) { HT_SET_DATA_ADDR(ht, php_parallel_copy_memory_func(HT_GET_DATA_ADDR(source), @@ -301,7 +301,7 @@ static zend_always_inline HashTable *php_parallel_copy_hash_thread(HashTable *so HT_SET_DATA_ADDR(ht, emalloc(HT_SIZE(ht))); memcpy(HT_GET_DATA_ADDR(ht), HT_GET_DATA_ADDR(source), HT_HASH_SIZE(ht->nTableMask)); -#ifdef HT_PACKED_SIZE +#if PHP_VERSION_ID >= 80200 if (HT_IS_PACKED(ht)) { zval *p = ht->arPacked, *q = source->arPacked, *p_end = p + ht->nNumUsed; for (; p < p_end; p++, q++) { @@ -388,7 +388,7 @@ void php_parallel_copy_hash_dtor(HashTable *table, bool persistent) #endif } -#ifdef HT_PACKED_SIZE +#if PHP_VERSION_ID >= 80200 if (HT_IS_PACKED(table)) { zval *p = table->arPacked, *end = p + table->nNumUsed; while (p < end) {