From ebd813ae95a52e291576fe24cc8c631126584492 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 1 Sep 2012 01:46:31 +0200 Subject: [PATCH] don't throw errors in the autoloader when a class doesn't exist --- lib/base.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/base.php b/lib/base.php index 1798bf09b9..f9adefd8b6 100644 --- a/lib/base.php +++ b/lib/base.php @@ -78,20 +78,25 @@ class OC{ require_once $path; } elseif(strpos($className,'OC_')===0){ - require_once strtolower(str_replace('_','/',substr($className,3)) . '.php'); + $path = strtolower(str_replace('_','/',substr($className,3)) . '.php'); } elseif(strpos($className,'OCP\\')===0){ - require_once 'public/'.strtolower(str_replace('\\','/',substr($className,3)) . '.php'); + $path = 'public/'.strtolower(str_replace('\\','/',substr($className,3)) . '.php'); } elseif(strpos($className,'OCA\\')===0){ - require_once 'apps/'.strtolower(str_replace('\\','/',substr($className,3)) . '.php'); + $path = 'apps/'.strtolower(str_replace('\\','/',substr($className,3)) . '.php'); } elseif(strpos($className,'Sabre_')===0) { - require_once str_replace('_','/',$className) . '.php'; + $path = str_replace('_','/',$className) . '.php'; } elseif(strpos($className,'Test_')===0){ - require_once 'tests/lib/'.strtolower(str_replace('_','/',substr($className,5)) . '.php'); + $path = 'tests/lib/'.strtolower(str_replace('_','/',substr($className,5)) . '.php'); } + + if($fullPath = stream_resolve_include_path($path)){ + require_once $path; + } + return false; } public static function initPaths(){