ID: 43736 Updated by: [EMAIL PROTECTED] Reported By: robin_fernandes at uk dot ibm dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows PHP Version: 5.2.5 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2008-01-03 10:47:32] robin_fernandes at uk dot ibm dot com Description: ------------ Even with a __get() that returns by reference, attempting to return an overloaded property by reference directly will return by value with a notice. A work-around is to assign the overloaded property by reference to another variable, and return that variable. However, I think it should be possible to return the property by reference directly. This affects 5.2.5 and the latest 5.3 and 6.0 snaps. Reproduce code: --------------- Testcase over 20 lines - see: http://pastebin.com/f35a74bdb Expected result: ---------------- Get reference to global via return-by-ref __get() called implicitly - OK: string(13) "First change!" Get reference to global via return-by-ref __get() called explicitly from return-by-ref function - OK: string(14) "Second change!" Get reference to global via return-by-ref __get() called implicitly from return-by-ref function: string(13) "Third change!" Actual result: -------------- Get reference to global via return-by-ref __get() called implicitly - OK: string(13) "First change!" Get reference to global via return-by-ref __get() called explicitly from return-by-ref function - OK: string(14) "Second change!" Get reference to global via return-by-ref __get() called implicitly from return-by-ref function: Notice: Only variable references should be returned by reference in %s on line 20 string(8) "original" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43736&edit=1