Description
Category:
Bug
A function is defined as returning-by-reference, but the result is not assigned by reference. This means that the reference is broken, and the return value will be duplicated upon assignment.
Example
Incorrect
function &
foo
()
{
$ret
= new
X
();
return
$ret
;
}
$a
=
foo
();
Correct
function &
foo
()
{
$ret
= new
X
();
return
$ret
;
}
$a
=&
foo
();