|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-31 12:58 UTC] derick@php.net
[2005-11-01 17:51 UTC] olympic at dino-online dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 10:00:02 2025 UTC |
Description: ------------ $this is treated as references, while ($this) not... $this != ($this) ?? omg :) Reproduce code: --------------- error_reporting(E_ALL); class Bar { function onlyByRefPlease(&$foo) { // ... } function someMemberFunc1() { $this->onlyByRefPlease($this); } function someMemberFunc2() { $this->onlyByRefPlease(($this)); // note: 2 Braces! } }; $foo = new Bar(); $foo->someMemberFunc1(); $foo->someMemberFunc2(); // throws error Expected result: ---------------- /* none */ Actual result: -------------- Fatal error: Only variables can be passed by reference in /www/v3.evalanche.com/web/php_refbug.php on line 13