#29877 [Fbk->Opn]: variable assign by reference works even when methods don't return by reference
| From: | bharat at menalto dot com | Date: | Tue, 28 Sep 2004 21:44:46 +0000 |
| Subject: | #29877 [Fbk->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-66840@lists.php.net to get a copy of this message | ||
ID: 29877
User updated by: bharat at menalto dot com
Reported By: bharat at menalto dot com
-Status: Feedback
+Status: Open
Bug Type: Scripting Engine problem
Operating System: FreeBSD 4.8
PHP Version: 4.3.8
New Comment:
Er, I did submit the url to a short and complete script that
demonstrates the problem, just as you requested. :-( What more can I
provide here?
Previous Comments:
------------------------------------------------------------------------
[2004-09-28 23:15:19] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[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