summaryrefslogtreecommitdiff
path: root/Zend/tests/bug64555.phpt
blob: 23bfd4a5e9a6e27d4343115d25476b6a8b19eabe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--TEST--
Bug #64555: Array key within interned string gets wrong hash value
--FILE--
<?php

class Foo {
    protected $unsetme = 1;
    protected $keepme = 2;

    public function test() {
        $a = get_object_vars($this);

        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;
            }
        }

        var_dump($a, array_keys($a));
    }
}

$f = new Foo;
$f->test();

?>
--EXPECT--
Unsetting: unsetme
Changing: keepme
array(1) {
  ["keepme"]=>
  int(43)
}
array(1) {
  [0]=>
  string(6) "keepme"
}