php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8514 function returning references changes other vars
Submitted: 2001-01-02 06:28 UTC Modified: 2001-03-06 06:56 UTC
From: hp at oeri dot ch Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.4 OS: Linux 2.2.17
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: hp at oeri dot ch
New email:
PHP Version: OS:

 

 [2001-01-02 06:28 UTC] hp at oeri dot ch
According to doc, to return references I need the following:

function &IReturnRef() AND $myvar = &IReturnRef();
(ampersand in BOTH places!)

Upto 4.03pl1, it worked quite well w/o ampersand in the call... Now in 4.0.4 it works, too BUT CHANGES OTHER VARS (vars totally unrelated to the function call!). I've yet to find out, when and which vars it touches... It seems to be the vars defined just before the call or the var used with the last call of the same function.

May I suggest that:
a) there's an error msg, if I call such a function w/o ampersand
   (hey, we're all human and forget things now and then)
OR
b) the behaviour is changed such that an ampersand in EITHER place
   returns a reference (this would be REALLY nice!)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-09 10:25 UTC] stas@php.net
Could you please provide example of the faulty code?
 [2001-03-06 06:56 UTC] stas@php.net
No feedback, closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 07:01:32 2024 UTC