mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed bug #72943 (assign_dim on string doesn't reset hval)
This commit is contained in:
parent
57509fb969
commit
c67fa3c91d
3 changed files with 22 additions and 0 deletions
1
NEWS
1
NEWS
|
@ -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).
|
||||
|
|
20
Zend/tests/bug72943.phpt
Normal file
20
Zend/tests/bug72943.phpt
Normal 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)
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue