xref: /PHP-5.6/Zend/tests/bug44660.phpt (revision 610c7fbe)
1--TEST--
2Bug #44660 (Indexed and reference assignment to propery of non-object don't trigger warning)
3--FILE--
4<?php
5$s = "hello";
6$a = true;
7
8echo "--> read access: ";
9echo $a->p;
10
11echo "\n--> direct assignment: ";
12$a->p = $s;
13
14echo "\n--> increment: ";
15$a->p++;
16
17echo "\n--> reference assignment:";
18$a->p =& $s;
19
20echo "\n--> reference assignment:";
21$s =& $a->p;
22
23echo "\n--> indexed assignment:";
24$a->p[0] = $s;
25
26echo "\n--> Confirm assignments have had no impact:\n";
27var_dump($a);
28?>
29--EXPECTF--
30--> read access:
31Notice: Trying to get property of non-object in %sbug44660.php on line 6
32
33--> direct assignment:
34Warning: Attempt to assign property of non-object in %sbug44660.php on line 9
35
36--> increment:
37Warning: Attempt to increment/decrement property of non-object in %sbug44660.php on line 12
38
39--> reference assignment:
40Warning: Attempt to modify property of non-object in %sbug44660.php on line 15
41
42--> reference assignment:
43Warning: Attempt to modify property of non-object in %sbug44660.php on line 18
44
45--> indexed assignment:
46Warning: Attempt to modify property of non-object in %sbug44660.php on line 21
47
48--> Confirm assignments have had no impact:
49bool(true)
50