From: public at grik dot net Operating system: linux PHP version: 5.0.3 PHP Bug Type: Class/Object related Bug description: calling of the parent class method leads to recursion and segmentation fault
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: ---------------- Really, I would like to see the output of " class a " string, cause it's not convenient to rewrite all occurences of $this->method() to self::method in the base classes. But I understand there is a new paradigm of "final" methods now and I will use it. I would like to see the endless loop until script execution time expires: B::a1() calls A::a2() and vice versa Actual result: -------------- Segmentation fault -- Edit bug report at http://bugs.php.net/?id=31474&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31474&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31474&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31474&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31474&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31474&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31474&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31474&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31474&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31474&r=support Expected behavior: http://bugs.php.net/fix.php?id=31474&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31474&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31474&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31474&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31474&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31474&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31474&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31474&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31474&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31474&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31474&r=mysqlcfg