suppress YiiBase::autoload error

In my project I need my custom autoloader to be excuted AFTER Yii default one.

So I add this code:




spl_autoload_register(array('CustomAutoLoader','autoload'));



Then when I call a class, which is supposed to be loaded by a custom autoloader it works fine, but Yii autoloader still shows PHP error ‘…failed to open stream: No such file or directory…’

How do I suppress this warning?

Thank you.

Actually here’s the main issue.

I can change the order, so my autoloader runs first, but at some point Yii stops calling my autoloader before default one.

Sample calls stack trace:

CustomLoader:CWebApplication

YiiBase:CWebApplication

CustomLoader:CApplication

YiiBase:CApplication

CustomLoader:CModule

YiiBase:CModule

CustomLoader:CComponent

YiiBase:CComponent

CustomLoader:CMap

YiiBase:CMap

CustomLoader:CAttributeCollection

YiiBase:CAttributeCollection

CustomLoader:CLogger

YiiBase:CLogger

YiiBase:CLogRouter <- didn’t even try to call CustomLoader

CustomLoader:CApplicationComponent

YiiBase:CApplicationComponent

YiiBase:CProfileLogRoute <- again

CustomLoader:CWebLogRoute

YiiBase:CWebLogRoute

CustomLoader:CLogRoute

YiiBase:CLogRoute

CustomLoader:CList

YiiBase:CList

YiiBase:DHttpRequest <- one more

YiiBase:CErrorEvent

YiiBase:CErrorHandler

YiiBase:CHtml

YiiBase:DThemeManager <- one more, here it shows an error

CustomLoader:DThemeManager <- loads class ok

CustomLoader:CThemeManager

YiiBase:CThemeManager

OK, seems I’m writing to myself, but if anybody would have a common problem, here’s where that issue is coming from.

YiiBase::createComponent calls Yii::import with forceInclude set to true,

then Yii::import does this:




if(($pos=strrpos($alias,'.'))===false)  // a simple class name

		{

			if($forceInclude && self::autoload($alias))

				self::$_imports[$alias]=$alias;

			return $alias;

		}



So this is not going through a normal autoloading process, it calls self::autoload directly.

I’m now looking into extending YiiBase and rewriting import function.