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
 [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: Fri Apr 26 13:01:28 2024 UTC