php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51570 is_subclass_of fails to autoload the classes
Submitted: 2010-04-16 15:56 UTC Modified: 2013-02-18 00:34 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ealexs at gmail dot com Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.2.13 OS: Debian
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-04-16 15:56 UTC] ealexs at gmail dot com
Description:
------------
is_subclass_of fails to autoload the classes causing PHP do die and apache returns an empty page. NO error is triggered ! It was very hard to find the cause

My php config it's here:
http://alex.softdev.ro/info.php

Failing function:
function ClassIsA($object_class, $class)
	{
		if ($object_class == $class)
			return true;
		return (is_subclass_of($object_class, $class));
	}


If changed it works:

function ClassIsA($object_class, $class)
	{
		// use this to force the load of the classes
		if (!class_exists($object_class))
			throw new Exception("Class $object_class not found");
		// use this to force the load of the classes
		if (!class_exists($class))
			throw new Exception("Class $class not found");
			
		if ($object_class == $class)
			return true;
		return (is_subclass_of($object_class, $class));
	}

looks like calling class_exists calls autoload and works fine

Thanks,
Alex

Test script:
---------------
Failing function:
function ClassIsA($object_class, $class)
	{
		if ($object_class == $class)
			return true;
		return (is_subclass_of($object_class, $class));
	}


If changed it works:

function ClassIsA($object_class, $class)
	{
		// use this to force the load of the classes
		if (!class_exists($object_class))
			throw new Exception("Class $object_class not found");
		// use this to force the load of the classes
		if (!class_exists($class))
			throw new Exception("Class $class not found");
			
		if ($object_class == $class)
			return true;
		return (is_subclass_of($object_class, $class));
	}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-21 16:36 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2010-04-21 16:36 UTC] felipe@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 for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

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.


 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot 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-2022 The PHP Group
All rights reserved.
Last updated: Wed Sep 28 04:05:55 2022 UTC