You can observe the same effect using ReflectionClass: new ReflectionClass($class);
If there's no $class, expected ReflectionException is thrown, but php warning as well. Any chance to fix it? Regards 2009/5/28 Karol Grecki <[email protected]>: > > Before 1.8 it was possible to something like this: > > if (! class_exists($class)) throw new Exception("$class not found"); > > If the class wasn't loaded, or couldn't be loaded (using autoloader) it > would just return false. > Now in 1.8 it throws a warning include(...): failed to open stream: No such > file or directory > > Doing @class_exists($class) has nasty effect of silencing all errors in the > file, even parse errors. > I tried suppressNotFoundWarnings(true) in the autoloader, but it essentially > does the same but for all classes which is even worse. IMO this method is > not named properly because it suppresses a lot more than "not found" > warnings. > > Is there any way in ZF 1.8 to check if a class is loaded/can be loaded > without producing any warnings in case it's not? Assuming full error > suppression is not an option for obvious reasons. > > Thanks
