[PHP-DEV] important bug, please read From: André Langhorst (waldschrott <email protected>)
Date: 10/28/00

Hi,
I´ve filed a weird OO-reference counting bug (7515). Verified with
serveral platforms and php versions. Originated from xml generating
code, thus should be considered a serious one.

Regards,
André

-- 
· André Langhorst       · t: +49 331 5811560 ·
· waldschrott <email protected>   · m: +49 173 9558736 ·
· PHP Quality Assurance · http://qa.php.net  ·

attached mail follows:


From: waldschrott <email protected> Operating system: linux + win2k PHP version: 4.0 Latest CVS (28/10/2000) PHP Bug Type: Scripting Engine problem Bug description: very weird, magic, invisible referencing

This code is pretty self-explanatory...

Uncommenting the noticed (*[0]) line, causes the object contained ('root') in the instance of 'obj' to be referenced to whatever, function test() uses a copy $o_copy but reference-counting fails and the contained object 'root' is somehow referenced to the original object in the global scope. After having uncommented *[0] try to uncomment *[1] what should break the reference again, that made me assuming this all is caused by reference counting...

<?php class obj { function method() {} }

function test($o_copy) { //$o_copy->root=&$o_copy->root; // *[1]

$o_copy->root->set_in_copied_o=TRUE; var_dump($o_copy);?><BR><?php }

$o->root=new obj(); //$o->root->method(); // *[0] uncomment this line and weirdness starts

var_dump($o);?><BR><?php test($o); var_dump($o); ?>

-- 
Edit Bug report at: http://bugs.php.net/?id=7515&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>