[1.1-dev] Can not use class_exists()

Hi,

I was just trying to check if a class_exists(), but unfortunately I can not use this PHP-function in an appropriate way, because it throws an PHP error like this:


PHP Error

Description


include(xxx.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

Source File


PATH/TO/pii/lib/yii/YiiBase.php(324)


00312:      * @param string class name

00313:      * @return boolean whether the class has been loaded successfully

00314:      */

00315:     public static function autoload($className)

00316:     {

00317:         // use include so that the error PHP file may appear

00318:         if(isset(self::$_coreClasses[$className]))

00319:             include(YII_PATH.self::$_coreClasses[$className]);

00320:         else if(isset(self::$_classes[$className]))

00321:             include(self::$_classes[$className]);

00322:         else

00323:         {

00324: include($className.'.php');

00325:             return class_exists($className,false) || interface_exists($className,false);

00326:         }

00327:         return true;

00328:     }

00329: 

00330:     /**

00331:      * Writes a trace message.

00332:      * This method will only log a message when the application is in debug mode.

00333:      * @param string message to be logged

00334:      * @param string category of the message

00335:      * @see log

00336:      */



Yiis autoloader creates a non-catchable PHP-error, any ideas on how to check if a class exists within the app, without getting a PHP-error?

Do I have to create my own autoloader?

Best regards,

schmunk

RTFM to myself, sorry!

bool class_exists ( string $class_name [, bool $autoload= true ] )

http://us2.php.net/manual/en/function.class-exists.php