Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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) {
Expand Down
23 changes: 23 additions & 0 deletions tests/base/075.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
Copy packed array return value
--SKIPIF--
<?php
if (!extension_loaded('parallel')) {
echo 'skip';
}
?>
--FILE--
<?php
var_dump((new parallel\Runtime())->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)
}