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:
----------------
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=31475&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31475&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31475&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31475&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31475&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31475&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31475&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31475&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31475&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31475&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31475&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31475&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31475&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31475&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31475&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31475&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31475&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31475&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31475&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31475&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31475&r=mysqlcfg

Reply via email to