diff --git a/lib/Mage/Autoload/Simple.php b/lib/Mage/Autoload/Simple.php index 22d20d7e032..64599153a4c 100644 --- a/lib/Mage/Autoload/Simple.php +++ b/lib/Mage/Autoload/Simple.php @@ -37,13 +37,14 @@ public static function register() spl_autoload_register([self::instance(), 'autoload']); } - /** - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ public function autoload($class) { $classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class))); $classFile .= '.php'; - @include $classFile; + /** @see https://stackoverflow.com/a/5504486/716029 */ + $found = stream_resolve_include_path($classFile); + if ($found !== false) { + include $found; + } } } diff --git a/lib/Magento/Autoload/Simple.php b/lib/Magento/Autoload/Simple.php index b7cf656b752..634593e8c3f 100644 --- a/lib/Magento/Autoload/Simple.php +++ b/lib/Magento/Autoload/Simple.php @@ -39,13 +39,14 @@ public static function register() spl_autoload_register([self::instance(), 'autoload']); } - /** - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ public function autoload($class) { $classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class))); $classFile .= '.php'; - @include $classFile; + /** @see https://stackoverflow.com/a/5504486/716029 */ + $found = stream_resolve_include_path($classFile); + if ($found !== false) { + include $found; + } } } diff --git a/lib/Varien/Autoload.php b/lib/Varien/Autoload.php index 23a82bf56b4..15fecbfff1b 100644 --- a/lib/Varien/Autoload.php +++ b/lib/Varien/Autoload.php @@ -54,8 +54,6 @@ public static function register() * Load class source code * * @param string $class - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) */ public function autoload($class) {