Edit report at http://bugs.php.net/bug.php?id=51555&edit=1
ID: 51555
Updated by: [email protected]
Reported by: sinisaculic at gmail dot com
Summary: Internal class reference resets the attribute
-Status: Open
+Status: Bogus
Type: Bug
Package: Class/Object related
Operating System: Windows 7
PHP Version: 5.3SVN-2010-04-14 (snap)
New Comment:
Yes, because it should be $b = &$this->t;
Previous Comments:
------------------------------------------------------------------------
[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 [email protected]
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.