Bug #51555 [Com]: Internal class reference resets the attribute
| From: | sinisaculic at gmail dot com | Date: | Wed, 14 Apr 2010 18:04:47 +0000 |
| Subject: | Bug #51555 [Com]: Internal class reference resets the attribute | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149564@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51555&edit=1
ID: 51555
Comment by: sinisaculic at gmail dot com
Reported by: sinisaculic at gmail dot com
Summary: Internal class reference resets the attribute
Status: Bogus
Type: Bug
Package: Class/Object related
Operating System: Windows 7
PHP Version: 5.3SVN-2010-04-14 (snap)
New Comment:
Ups.... mixed up C with PhP.... can someone delete this >.<`
Note to my self references and pointers are not the same PhP duos not
have
pointers....
Previous Comments:
------------------------------------------------------------------------
[2010-04-14 16:02:59] rasmus@php.net
Yes, because it should be $b = &$this->t;
------------------------------------------------------------------------
[2010-04-14 15:59:38] sinisaculic at gmail dot com
Description:
------------
I know it is uncommon usage of reference but i have a pretty
complicated
equation
inside a function, and i referenced a value like $a &= %this->bla...
It is easier to write $a instead $this->a... in case you have a BIG
equation...
And imagine my surprise when i saw that the value was not set... my
guess is
that
this code somehow screws the internal references.... Searched here and
nothing
showed up for classes... just run the script it should output the
error...
don`t
know about UNIX OP but i doubt it is different...
here is how i get the error:
class a {
public $t;
function buga(){
$this->t = 'buga';
}
function bla(){
$b &=$this->t;
echo $b;
}
}
$a= new a;
$a->buga();
$a->bla(); //this outputs Notice: Undefined variable: b in
C:\...\test.php on
line XX
I use Wamp Server package 2.0f latest version... Hope i was right about
it... if
not, Sorry...
With respect SiniÅ¡a ÄuliÄ at sinisaculic@gmail.com
Test script:
---------------
class a {
public $t;
function buga(){
$this->t = 'buga';
}
function bla(){
$b &=$this->t;
echo $b;
}
}
$a= new a;
$a->buga();
$a->bla(); //this outputs Notice: Undefined variable: b in
C:\...\test.php on line XX
Expected result:
----------------
This should output just bla
Actual result:
--------------
But it outputs a notice... and no variable...
this outputs Notice: Undefined variable: b in C:\...\test.php on line XX
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51555&edit=1