#35034 [Opn->Bgs]: $this != ($this)
ID: 35034
Updated by: derick@php.net
Reported By: olympic at dino-online dot de
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: *nix
PHP Version: 5.0.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
($this) is an expression, not a variable, thus you can not pass it by
reference.
Previous Comments:
------------------------------------------------------------------------
[2005-10-31 12:00:17] olympic at dino-online dot de
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35034&edit=1
Thread (3 messages)