I’ve created a system whereby items of various different model types are passed around in a ubiquitous manner. The problem that some of these types are simulated and don’t have a real model class associated with them. To check whether the given model exists or not, I’m attempting to use class_exists($Foo), but this is giving me a PHP Error as autoload in YiiBase is run and automatically attempts to include “$Foo.php”.
Is there any way around this behavior? How could I work around it, and shouldn’t Yii handle such checks in a more cautious manner by default?
Cheers, but this doesn’t quite solve my problem… Now, as the Model.php file hasn’t been loaded, the code fails. Right now I’m working around it by checking file_exists(“protected/models/Model.php”), but some form of middle ground would be preferable. Any ideas?
I see that include() creates a warning not a fatal error. Should Yii really always report this as fatal error? Yii could check the error level in CApplication::handleError().
There could be another constant like YII_ERROR_REPORTING that defines a bitmask (to be ANDed with the error code) and defaults to E_ALL & E_STRICT. Makes sense?
I know this thread’s old but this is a great fix. Since Yii doesn’t import classes until they’re needed, it should be able to survive if they’re not there. It would make more sense if YiiBase::autoload() had error suppression.