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