Bug #51570 [Opn->Fbk]: is_subclass_of fails to autoload the classes

From: Date: Wed, 21 Apr 2010 14:36:31 +0000
Subject: Bug #51570 [Opn->Fbk]: is_subclass_of fails to autoload the classes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-149757@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51570&edit=1

 ID:               51570
 Updated by:       felipe@php.net
 Reported by:      ealexs at gmail dot com
 Summary:          is_subclass_of fails to autoload the classes
-Status:           Open
+Status:           Feedback
 Type:             Bug
 Package:          Reproducible crash
 Operating System: Debian
 PHP Version:      5.2.13

 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
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.




Previous Comments:
------------------------------------------------------------------------
[2010-04-16 15:56:25] 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));
	}



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



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


Thread (3 messages)

« previous php.bugs (#149757) next »