PHP 4.0 Bug #6352 Updated: Crash while using references and classes
| From: | Bug Database | Date: | Fri, 25 Aug 2000 20:23:30 +0000 |
| Subject: | PHP 4.0 Bug #6352 Updated: Crash while using references and classes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-30692@lists.php.net to get a copy of this message | ||
ID: 6352
Updated by: waldschrott
Reported By: k.reimer@twisd.de
Status: Closed
Bug Type: Reproduceable crash
Assigned To:
Comments:
Pass-by-reference from call-time is deprecated and optional
referenced parameters are not implemented, I´ve modified
your script, thus you should be able to figure out, how to
do this in PHP4....
<?php
// --- Base class ---
class CBase {
var $aChildren=array();
function addChildren(&$Children) {
$this->aChildren[]=&$Children;
}
function drawChildren() {
while ($a=each($this->aChildren)) {
$a[value]->draw(); }
}
}
// --- Test class 1 ---
class CTest extends CBase {
function draw() {
printf("This is CTest<br>\n"); }
}
// --- Test class 2 ---
class CTest2 extends CBase {
function draw() {
printf("This is CTest2<br>\n");
$this->drawChildren();
}
}
printf("<html><body>");
$Test=new CTest();
// --- Block 3 begin ------
$Test2=new CTest2();
$Test2->addChildren($Test);
$Test2->draw();
printf("</body></html>");
?>
Full Bug description available at: http://bugs.php.net/?id=6352