php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41312 pass by reference works without storage
Submitted: 2007-05-07 11:42 UTC Modified: 2007-05-07 12:09 UTC
From: vinhar at optusnet dot com dot au Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5CVS-2007-05-07 (CVS) OS: windows 5 sp4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vinhar at optusnet dot com dot au
New email:
PHP Version: OS:

 

 [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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-07 12:09 UTC] bjori@php.net
[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

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 04:01:29 2024 UTC