Skip to content

Commit 557f1cc

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed bug #72943 (assign_dim on string doesn't reset hval) Conflicts: Zend/zend_execute.c
2 parents 726e3b8 + c67fa3c commit 557f1cc

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? 2016, PHP 7.1.0RC1
44

55
- Core:
6+
. Fixed bug #72943 (assign_dim on string doesn't reset hval). (Laruence)
67
. Fixed bug #72598 (Reference is lost after array_slice()) (Nikita)
78

89
- COM:

Zend/tests/bug72943.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #72943 (assign_dim on string doesn't reset hval)
3+
--FILE--
4+
<?php
5+
$array = array("test" => 1);
6+
7+
$a = "lest";
8+
var_dump($array[$a]);
9+
$a[0] = "f";
10+
var_dump($array[$a]);
11+
$a[0] = "t";
12+
var_dump($array[$a]);
13+
?>
14+
--EXPECTF--
15+
Notice: Undefined index: lest in %sbug72943.php on line %d
16+
NULL
17+
18+
Notice: Undefined index: fest in %sbug72943.php on line %d
19+
NULL
20+
int(1)

Zend/zend_execute.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
13301330
zend_string_release(old_str);
13311331
} else {
13321332
SEPARATE_STRING(str);
1333+
zend_string_forget_hash_val(Z_STR_P(str));
13331334
}
13341335

13351336
Z_STRVAL_P(str)[offset] = c;

0 commit comments

Comments
 (0)