#31475 [Opn->Bgs]: calling of the parent class method leads to recursion and segmentation fault

From: Date: Mon, 10 Jan 2005 16:31:07 +0000
Subject: #31475 [Opn->Bgs]: calling of the parent class method leads to recursion and segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-71749@lists.php.net to get a copy of this message
ID: 31475 Updated by: tony2001@php.net Reported By: public at grik dot net -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: linux PHP Version: 5.0.3 New Comment: Submitted twice. Previous Comments: ------------------------------------------------------------------------ [2005-01-10 17:24:23] public at grik dot net Description: ------------ When I moved my classes hierarchy code from the PHP 4 to the PHP 5 and renamed costructors from the class names to "__construct", I faced a segmentation fault. The constructor calls the parent's constructor. Parent's constructor calls another method, overloaded in the child's class. That overloaded method from the child's class calls the constructor that calls the parent's constructor again. But instead of the endless loop I get the segfault. Reproduce code: --------------- class A{ function a1(){ echo ' class a '; } function a2(){ $this->a1(); } } class B extends A { function a1(){ $this->a2(); } function __construct(){ parent::a2(); } } $a= new B(); Expected result: ---------------- The endless loop until script execution time expires: B::a1() calls A::a2() and vice versa Actual result: -------------- Segmentation fault ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31475&edit=1

« previous php.bugs (#71749) next »