Bug #51570 [NEW]: is_subclass_of fails to autoload the classes

From: Date: Fri, 16 Apr 2010 13:56:26 +0000
Subject: Bug #51570 [NEW]: is_subclass_of fails to autoload the classes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-149606@lists.php.net to get a copy of this message
From:             
Operating system: Debian
PHP version:      5.2.13
Package:          Reproducible crash
Bug Type:         Bug
Bug description:is_subclass_of fails to autoload the classes

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 bug report at http://bugs.php.net/bug.php?id=51570&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51570&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51570&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51570&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51570&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51570&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51570&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51570&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51570&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51570&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51570&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51570&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51570&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51570&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51570&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51570&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51570&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51570&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51570&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51570&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51570&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51570&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#149606) next »