php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26439 Cannot directly return references
Submitted: 2003-11-27 15:56 UTC Modified: 2003-11-28 04:33 UTC
From: zhundiak at comcast dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0b2 (beta2) OS: NA - linux/windows
Private report: No CVE-ID: None
 [2003-11-27 15:56 UTC] zhundiak at comcast dot net
Description:
------------
A function cannot directly return a reference produced by another function without first assigning it to a tmp variable.
This is a specialization of bug 24687.  

Reproduce code:
---------------
function &getSomeReference()
{
  return getSomeOtherReference(); // Fails
}
function &getSomeReference()
{
  $tmp =& getSomeOtherReference(); // Works
  return $tmp;
}


Expected result:
----------------
It should work.

Actual result:
--------------
Fatal error: Only variables or references can be returned by reference


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-28 04:33 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Same as bug #24687 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Aug 17 09:01:28 2024 UTC