From: [EMAIL PROTECTED]
Operating system: Linux RedHat 7.2
PHP version: 4.1.2
PHP Bug Type: Class/Object related
Bug description: pointers and globals don't work together
While using classes, pointers and globals I noticed data not being migrated
to the globalsphere due to pointerassignments.
[Example]
class test {
var $v=0;
function set($i) { $this->v = $i; }
}
$a = new test();
$b =& new test();
$c =& $b;
function ta() {
global $a,$b,$c;
$a->set(1);
$b =& $a;
$c->set(2);
}
ta();
echo "$a->v,$b->v,$c->v";
[/example]
This should display 1,1,2 since $b has been set to $a, but this
pointer-assigment isn't emigrated to the global $b.
I have done many expirements with it to see if i could further specify the
bug... at first i thought it was destroying non-globals that got pointed
too at the end of the functioncall and thus (accidently) destroying the
pointers in the process, but then if i would point $a to $b and export
them both, neither should be destroyed, so the reference should stay
intact... it isn't.
So the only thing that remains is that function-local pointer-assigments
not seem to affect my global var.
--
Edit bug report at http://bugs.php.net/?id=16712&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16712&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16712&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16712&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16712&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16712&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16712&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16712&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16712&r=submittedtwice