PHP 4.0 Bug #8514: function returning references changes other vars

From: Date: Tue, 02 Jan 2001 11:28:42 +0000
Subject: PHP 4.0 Bug #8514: function returning references changes other vars
Groups: php.dev 
Request: Send a blank email to php-dev+get-42576@lists.php.net to get a copy of this message
From: hp@oeri.ch Operating system: Linux 2.2.17 PHP version: 4.0.4 PHP Bug Type: Scripting Engine problem Bug description: function returning references changes other vars 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!) -- Edit Bug report at: http://bugs.php.net/?id=8514&edit=1

« previous php.dev (#42576) next »