1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 05:02:27 +02:00

Merge branch 'PHP-7.1'

* PHP-7.1:
  Fixed bug #72943 (assign_dim on string doesn't reset hval)
This commit is contained in:
Xinchen Hui
2016-08-26 18:33:10 +08:00
2 changed files with 21 additions and 0 deletions

20
Zend/tests/bug72943.phpt Normal file
View File

@@ -0,0 +1,20 @@
--TEST--
Bug #72943 (assign_dim on string doesn't reset hval)
--FILE--
<?php
$array = array("test" => 1);
$a = "lest";
var_dump($array[$a]);
$a[0] = "f";
var_dump($array[$a]);
$a[0] = "t";
var_dump($array[$a]);
?>
--EXPECTF--
Notice: Undefined index: lest in %sbug72943.php on line %d
NULL
Notice: Undefined index: fest in %sbug72943.php on line %d
NULL
int(1)

View File

@@ -1330,6 +1330,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
zend_string_release(old_str);
} else {
SEPARATE_STRING(str);
zend_string_forget_hash_val(Z_STR_P(str));
}
Z_STRVAL_P(str)[offset] = c;