php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30134 Reflection cause segmentation fault
Submitted: 2004-09-17 15:06 UTC Modified: 2004-09-28 23:18 UTC
From: dankab at infinito dot it Assigned:
Status: No Feedback Package: Class/Object related
PHP Version: 5.0.1 OS: linux
Private report: No CVE-ID: None
 [2004-09-17 15:06 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-17 15:36 UTC] derick@php.net
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.
 [2004-09-28 23:18 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 09 10:01:27 2024 UTC