From: dankab at infinito dot it
Operating system: linux
PHP version: 5.0.1
PHP Bug Type: Class/Object related
Bug description: Reflection cause segmentation fault
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 bug report at http://bugs.php.net/?id=30134&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30134&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30134&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30134&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30134&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30134&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30134&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30134&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30134&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30134&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30134&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30134&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30134&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30134&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30134&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30134&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30134&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30134&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30134&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30134&r=mysqlcfg