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

 ID:                 53036
 Updated by:         ahar...@php.net
 Reported by:        steven dot hartland at multiplay dot co dot uk
 Summary:            class_exists fails to return for missing dependent
                     classes
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Class/Object related
 Operating System:   FreeBSD 8.1-RELEASE
 PHP Version:        5.2.14
 Block user comment: N

 New Comment:

You're suppressing errors with the @ operator in the include_once call
-- because there's no MyBaseClass.php file, the autoload fails, which
results in a fatal error when class MyBaseClass can't be found. Without
the @ operator, you get two warnings, then the fatal error, which is
silenced in your code.



Not a PHP bug -> closing.


Previous Comments:
------------------------------------------------------------------------
[2010-10-10 17:53:04] steven dot hartland at multiplay dot co dot uk

Description:
------------
If you call class_exists( $sClass ) which in turn triggers an autoloader
that 

fails to load a dependent class of $sClass e.g. where $sClass extends a
missing 

class, then class_exists fails silently and never returns.



Note this only fails on missing dependent classes if the original class
fails to 

load then class_exists returns false as expected.



Also tested on 5.3.3 same results

Test script:
---------------
Test case files here:

http://www.multiplaygameservers.com/dropzone/php-autoload-failure.tar.gz

Expected result:
----------------
factory: MyClass

autoload: MyClass

including: MyClass

autoload: MyBaseClass

including: MyBaseClass

included:  for MyBaseClass, 

Failed to autoload: MyClass

Failed to load 'MyClass'





Actual result:
--------------
factory: MyClass

autoload: MyClass

including: MyClass

autoload: MyBaseClass

including: MyBaseClass

included:  for MyBaseClass, 

<-- Nothing more -->



Running with missing initial class:

factory: MyClass

autoload: MyClass

including: MyClass

included:  for MyClass, 

Failed to autoload: MyClass

Failed to load 'MyClass'


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



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

Reply via email to