php-src/Zend/tests/bug64555.phpt

43 lines
741 B
Plaintext
Raw Normal View History

--TEST--
Bug #64555: Array key within interned string gets wrong hash value
--FILE--
<?php
2018-09-16 17:16:42 +00:00
class Foo {
protected $unsetme = 1;
protected $keepme = 2;
2018-09-16 17:16:42 +00:00
public function test() {
$a = get_object_vars($this);
2018-09-16 17:16:42 +00:00
foreach ($a as $k => $v) {
if ($k == 'unsetme') {
echo "Unsetting: $k\n";
unset($a[$k]);
} else if ($k == 'keepme') {
echo "Changing: $k\n";
$a[$k] = 42;
$a['keepme'] = 43;
}
}
2018-09-16 17:16:42 +00:00
var_dump($a, array_keys($a));
}
}
2018-09-16 17:16:42 +00:00
$f = new Foo;
$f->test();
2018-09-16 17:16:42 +00:00
?>
--EXPECT--
Unsetting: unsetme
Changing: keepme
array(1) {
["keepme"]=>
int(43)
}
array(1) {
[0]=>
string(6) "keepme"
}