xref: /PHP-5.4/Zend/tests/bug52041.phpt (revision 5c6e5726)
1--TEST--
2Bug #52041 (Memory leak when writing on uninitialized variable returned from function)
3--FILE--
4<?php
5function foo() {
6	return $x;
7}
8
9foo()->a = 1;
10foo()->a->b = 2;
11foo()->a++;
12foo()->a->b++;
13foo()->a += 2;
14foo()->a->b += 2;
15
16foo()[0] = 1;
17foo()[0][0] = 2;
18foo()[0]++;
19foo()[0][0]++;
20foo()[0] += 2;
21foo()[0][0] += 2;
22
23var_dump(foo());
24?>
25--EXPECTF--
26Notice: Undefined variable: x in %sbug52041.php on line 3
27
28Warning: Creating default object from empty value in %sbug52041.php on line 6
29
30Notice: Undefined variable: x in %sbug52041.php on line 3
31
32Warning: Creating default object from empty value in %sbug52041.php on line 7
33
34Notice: Undefined variable: x in %sbug52041.php on line 3
35
36Warning: Creating default object from empty value in %sbug52041.php on line 8
37
38Notice: Undefined variable: x in %sbug52041.php on line 3
39
40Warning: Creating default object from empty value in %sbug52041.php on line 9
41
42Notice: Undefined variable: x in %sbug52041.php on line 3
43
44Warning: Creating default object from empty value in %sbug52041.php on line 10
45
46Notice: Undefined variable: x in %sbug52041.php on line 3
47
48Warning: Creating default object from empty value in %sbug52041.php on line 11
49
50Notice: Undefined variable: x in %sbug52041.php on line 3
51
52Notice: Undefined variable: x in %sbug52041.php on line 3
53
54Notice: Undefined variable: x in %sbug52041.php on line 3
55
56Notice: Undefined offset: 0 in %sbug52041.php on line 15
57
58Notice: Undefined variable: x in %sbug52041.php on line 3
59
60Notice: Undefined offset: 0 in %sbug52041.php on line 16
61
62Notice: Undefined offset: 0 in %sbug52041.php on line 16
63
64Notice: Undefined variable: x in %sbug52041.php on line 3
65
66Notice: Undefined offset: 0 in %sbug52041.php on line 17
67
68Notice: Undefined variable: x in %sbug52041.php on line 3
69
70Notice: Undefined offset: 0 in %sbug52041.php on line 18
71
72Notice: Undefined offset: 0 in %sbug52041.php on line 18
73
74Notice: Undefined variable: x in %sbug52041.php on line 3
75NULL
76