xref: /PHP-8.0/Zend/tests/bug43201.phpt (revision 36935e42)
1--TEST--
2Bug #43201 (Crash on using uninitialized vals and __get/__set)
3--FILE--
4<?php
5class Foo {
6    function __get($k) {
7        return null;
8    }
9    function __set($k, $v) {
10        $this->$k = $v;
11    }
12}
13
14$c = new Foo();
15
16$c->arr[0]["k"] = 1;
17$c->arr[0]["k2"] = $ref;
18for($cnt=0;$cnt<6;$cnt++) {
19    $ref = chop($undef);
20    $c->arr[$cnt]["k2"] = $ref;
21}
22echo "ok\n";
23?>
24--EXPECTF--
25Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 13
26
27Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 14
28
29Warning: Undefined variable $ref in %s on line %d
30
31Warning: Undefined variable $undef in %s on line %d
32
33Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
34
35Warning: Undefined variable $undef in %s on line %d
36
37Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
38
39Warning: Undefined variable $undef in %s on line %d
40
41Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
42
43Warning: Undefined variable $undef in %s on line %d
44
45Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
46
47Warning: Undefined variable $undef in %s on line %d
48
49Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
50
51Warning: Undefined variable $undef in %s on line %d
52
53Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
54ok
55