1--TEST--
2Returning a references returned by another function
3--FILE--
4<?php
5
6
7function &returnVarByRef () {
8    $b=1;
9    return $b;
10}
11
12function &testReturnVarByRef() {
13    return returnVarByRef();
14}
15
16function returnVal () {
17return 1;
18}
19
20function &testReturnValByRef() {
21    return returnVal();
22}
23
24echo "\n---> 1. Return a variable by reference -> No warning:\n";
25
26var_dump (testReturnVarByRef());
27
28echo "\n---> 2. Return a value by reference -> Warning:\n";
29
30var_dump (testReturnValByRef());
31?>
32--EXPECTF--
33---> 1. Return a variable by reference -> No warning:
34int(1)
35
36---> 2. Return a value by reference -> Warning:
37
38Notice: Only variable references should be returned by reference in %s on line %d
39int(1)
40