diff options
author | Xinchen Hui <laruence@gmail.com> | 2016-08-26 18:30:08 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2016-08-26 18:30:08 +0800 |
commit | c67fa3c91d314fd932fa1c921497fe3e6a968785 (patch) | |
tree | 48372766b3689ee1c5cf68604e7d69f70211998b | |
parent | 57509fb969c1cce74dfb9dfec882b92aefd9be69 (diff) | |
download | php-git-c67fa3c91d314fd932fa1c921497fe3e6a968785.tar.gz |
Fixed bug #72943 (assign_dim on string doesn't reset hval)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | Zend/tests/bug72943.phpt | 20 | ||||
-rw-r--r-- | Zend/zend_execute.c | 1 |
3 files changed, 22 insertions, 0 deletions
@@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2016 PHP 7.0.11 - Core: + . Fixed bug #72943 (assign_dim on string doesn't reset hval). (Laruence) . Fixed bug #72911 (Memleak in zend_binary_assign_op_obj_helper). (Laruence) . Fixed bug #72813 (Segfault with __get returned by ref). (Laruence) . Fixed bug #72767 (PHP Segfaults when trying to expand an infinite operator). 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 9a3f69e026..2882f3dc33 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1335,6 +1335,7 @@ static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *valu zend_string_release(tmp); } else { Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0]; + zend_string_forget_hash_val(Z_STR_P(str)); } /* * the value of an assignment to a string offset is undefined |