Skip to content
Browse files

Fixed PHP error reporting handling when Classloader includes files

  • Loading branch information...
1 parent ee4744a commit fd01b9e417661051e132c008515514919c1fe5cf @integry committed
Showing with 8 additions and 0 deletions.
  1. +8 −0 ClassLoader.php
View
8 ClassLoader.php
@@ -93,8 +93,14 @@ public static function load($class)
if (!class_exists($className, false))
{
+ // we don't want to display PHP errors if a file can't be included, but at the same time
+ // we also don't want to supress all error messages from include_once (could be a parse error, etc.)
+ $errLevel = error_reporting();
+ error_reporting(E_ALL ^ E_WARNING);
+
if(!(include_once($class.'.php')) && !self::$ignoreMissingClasses)
{
+ error_reporting($errLevel);
// WTF PHP bug
// #0 ClassLoader::load(g25c7hui)
// #1 spl_autoload_call(g25c7hui) <<== g25c7hui instead of EavField ?
@@ -112,6 +118,8 @@ public static function load($class)
ClassLoader::import("framework.ClassLoaderException");
throw new ClassLoaderException('File '.$class.'.php not found');
}
+
+ error_reporting($errLevel);
}
return $className;

0 comments on commit fd01b9e

Please sign in to comment.
Something went wrong with that request. Please try again.