1--TEST--
2Returning a reference from a method
3--FILE--
4<?php
5Class C {
6	function returnConstantByValue() {
7		return 100;
8	}
9
10	function &returnConstantByRef() {
11		return 100;
12	}
13
14	static function &returnVariableByRef() {
15		return $GLOBALS['a'];
16	}
17}
18$c = new C;
19
20echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
21unset($a, $b);
22$a = 4;
23$b = &$c->returnConstantByValue();
24$a++;
25var_dump($a, $b);
26
27echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
28unset($a, $b);
29$a = 4;
30$b = &$c->returnConstantByRef();
31$a++;
32var_dump($a, $b);
33
34echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
35unset($a, $b);
36$a = 4;
37$b = &$c->returnVariableByRef();
38$a++;
39var_dump($a, $b);
40
41?>
42--EXPECTF--
43
44---> 1. Trying to assign by reference the return value of a function that returns by value:
45
46Strict Standards: Only variables should be assigned by reference in %s on line 20
47int(5)
48int(100)
49
50---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
51
52Notice: Only variable references should be returned by reference in %s on line 8
53int(5)
54int(100)
55
56---> 3. Trying to assign by reference the return value of a function that returns by ref:
57int(5)
58int(5)
59