Skip to content

Commit 9afc61c

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
2 parents 6ffa1d2 + 5733fd1 commit 9afc61c

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ PHP NEWS
1010
with list()). (Laruence)
1111
. Fixed bug #73727 (ZEND_MM_BITSET_LEN is "undefined symbol" in
1212
zend_bitset.h). (Nikita)
13+
. Fixed bug #73753 (unserialized array pointer not advancing). (David Walker)
1314

1415
- CLI:
1516
. Fixed bug #72555 (CLI output(japanese) on Windows). (Anatol)

Zend/tests/bug73753.phpt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
Bug #73753 Non packed arrays and duplication
3+
--FILE--
4+
<?php
5+
function iterate($current, $a, $result = null) {
6+
if (!$current) {
7+
return $result;
8+
}
9+
10+
return iterate(getNext($a), $a, $current);
11+
}
12+
13+
function getNext(&$a) {
14+
return next($a);
15+
}
16+
17+
function getCurrent($a) {
18+
return current($a);
19+
}
20+
21+
function traverse($a) {
22+
return iterate(getCurrent($a), $a);
23+
}
24+
25+
$arr = array(1 => 'foo', 'b' => 'bar', 'baz');
26+
var_dump(traverse($arr));
27+
?>
28+
--EXPECTF--
29+
string(3) "baz"

Zend/zend_hash.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ static zend_always_inline void zend_array_dup_packed_elements(HashTable *source,
17281728

17291729
static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, HashTable *target, int static_keys, int with_holes)
17301730
{
1731-
uint32_t idx = 0;
1731+
uint32_t idx = 0;
17321732
Bucket *p = source->arData;
17331733
Bucket *q = target->arData;
17341734
Bucket *end = p + source->nNumUsed;
@@ -1756,7 +1756,7 @@ static zend_always_inline uint32_t zend_array_dup_elements(HashTable *source, Ha
17561756

17571757
ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
17581758
{
1759-
uint32_t idx;
1759+
uint32_t idx;
17601760
HashTable *target;
17611761

17621762
IS_CONSISTENT(source);
@@ -1820,7 +1820,8 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
18201820
target->u.flags = (source->u.flags & ~(HASH_FLAG_PERSISTENT|ZEND_HASH_APPLY_COUNT_MASK)) | HASH_FLAG_APPLY_PROTECTION;
18211821
target->nTableMask = source->nTableMask;
18221822
target->nNextFreeElement = source->nNextFreeElement;
1823-
target->nInternalPointer = HT_INVALID_IDX;
1823+
target->nInternalPointer = source->nInternalPointer;
1824+
18241825
HT_SET_DATA_ADDR(target, emalloc(HT_SIZE(target)));
18251826
HT_HASH_RESET(target);
18261827

0 commit comments

Comments
 (0)