xref: /PHP-8.2/Zend/tests/bug43201.phpt (revision b10416a6)
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
33Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
34
35Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
36
37Warning: Undefined variable $undef in %s on line %d
38
39Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated 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
45Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
46
47Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
48
49Warning: Undefined variable $undef in %s on line %d
50
51Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
52
53Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
54
55Warning: Undefined variable $undef in %s on line %d
56
57Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
58
59Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
60
61Warning: Undefined variable $undef in %s on line %d
62
63Deprecated: chop(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
64
65Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
66ok
67