#41312 [Opn->Bgs]: pass by reference works without storage
| From: | bjori@php.net | Date: | Mon, 07 May 2007 12:09:58 +0000 |
| Subject: | #41312 [Opn->Bgs]: pass by reference works without storage | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112340@lists.php.net to get a copy of this message | ||
ID: 41312
Updated by: bjori@php.net
Reported By: vinhar at optusnet dot com dot au
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: windows 5 sp4
PHP Version: 5CVS-2007-05-07 (CVS)
New Comment:
[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
Previous Comments:
------------------------------------------------------------------------
[2007-05-07 11:42:11] 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41312&edit=1