#29877 [Opn]: variable assign by reference works even when methods don't return by reference
| From: | sniper@php.net | Date: | Sun, 12 Dec 2004 15:29:41 +0000 |
| Subject: | #29877 [Opn]: variable assign by reference works even when methods don't return by reference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70078@lists.php.net to get a copy of this message | ||
ID: 29877
Updated by: sniper@php.net
Reported By: bharat at menalto dot com
Status: Open
Bug Type: Scripting Engine problem
Operating System: FreeBSD 4.8
PHP Version: 4CVS, 5CVS (2004-12-10)
New Comment:
Note: Tested with 4.2.2 and it works exactly the same.
IMO this is not a bug.
Previous Comments:
------------------------------------------------------------------------
[2004-08-28 22:56:41] bharat at menalto dot com
Description:
------------
According to the documentation here:
http://us4.php.net/manual/en/language.references.return.php
In order to assign a variable as a reference to a value returned by a
class method, the method needs to also return by reference. However,
on PHP 4.3.8 in my test script I've found that the semantics are the
same whether or not you return by reference.
This is surprising to me. I could have sworn that it didn't used to be
this way. Please let me know if you need more information. I can
reproduce this with a stock php.ini.
If this is the desired behaviour in this case, then we should update
the documentation to reflect that the ampersand is no longer necessary
on the getter method.
Reproduce code:
---------------
http://www.menalto.com/.outgoing/php/ref.php
Expected result:
----------------
The URL above indicates the expected results. I can elaborate if
necessary.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29877&edit=1