|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-07 11:42 UTC] vinhar at optusnet dot com dot au
Description:
------------
A function defined to return by reference returns data when there is no storage to reference without a warning or notice.
Error reporting is E_ALL.
Version 5.0.33
Reproduce code:
---------------
<?
&bug()
{
return 1 + 1;
}
$r = bug();
echo $r;
?>
Expected result:
----------------
A warning or notice as follows.
[NOTICE: Only variable references should be returned by reference]
Actual result:
--------------
The above function outputs 2.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 23:00:01 2025 UTC |
[bjori@lindsay ~]$ php -derror_reporting=8191 -a Interactive mode enabled <?php function &bug() { return 1 + 1; } $r = bug(); PHP Notice: Only variable references should be returned by reference in /usr/home/bjori/- on line 6