ID:               30134
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dankab at infinito dot it
-Status:           Open
+Status:           Feedback
 Bug Type:         Class/Object related
 Operating System: linux
 PHP Version:      5.0.1
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


Previous Comments:
------------------------------------------------------------------------

[2004-09-17 15:06:56] dankab at infinito dot it

Description:
------------
[sorry for my english]

the ReflectionClass cause a segmentation fault if the constructor of a
class, calling his parent constructor, throws an exception

if i use the syntax:

$myInstance = new $class_name();

all is ok

Reproduce code:
---------------
class A {
        function __construct() {
                try     {
                        $this->test();
                }       
                catch(Exception $e)     {
                        throw $e;
                }
        }
        
        public function test() {
                if(0!=1) throw new Exception("ERROR",100);
        }
}

class B extends A { 
        function __construct() {
                try     {
                        parent::__construct();
                }
                catch(Exception $e)     {
                        throw $e;       
                }       
        }       
}

try
{
        $class_name = "B";
        
        $class = new ReflectionClass($class_name);
        if ($class->isInstantiable()) 
                $myInstance = $class->newInstance();
}
catch(Exception $ex)
{
        echo $ex->getMessage();
}

Expected result:
----------------
printing of:
ERROR

Actual result:
--------------
segmentation fault in apache 2


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30134&edit=1

Reply via email to