diff options
author | Xinchen Hui <laruence@gmail.com> | 2016-08-26 18:33:10 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2016-08-26 18:33:10 +0800 |
commit | 5ac49731cf149e75e243d57784189b82da08885e (patch) | |
tree | c078f45d484cd30ded9fb594ddaef5fc54918040 | |
parent | 9950485d32f3e5e52a10e5fafa4bef7bd689de71 (diff) | |
parent | 557f1ccf0cc185d712597e11ecedff3171a69110 (diff) | |
download | php-git-5ac49731cf149e75e243d57784189b82da08885e.tar.gz |
Merge branch 'PHP-7.1'
* PHP-7.1:
Fixed bug #72943 (assign_dim on string doesn't reset hval)
-rw-r--r-- | Zend/tests/bug72943.phpt | 20 | ||||
-rw-r--r-- | Zend/zend_execute.c | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/Zend/tests/bug72943.phpt b/Zend/tests/bug72943.phpt new file mode 100644 index 0000000000..8bab6de456 --- /dev/null +++ b/Zend/tests/bug72943.phpt @@ -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) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index d2411ad5c3..f0f249e243 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -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; |