From a03a3680e28e246a8cc7f247b6c491e17a5460a5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 18:56:33 -0800 Subject: [PATCH] CRM_Core_ClassLoader - Fix compatibility with class_exists() The previous code would bomb if one called class_exists() on a non-existent CRM class. --- CRM/Core/ClassLoader.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CRM/Core/ClassLoader.php b/CRM/Core/ClassLoader.php index 4ab4e32236..a96787f2fa 100644 --- a/CRM/Core/ClassLoader.php +++ b/CRM/Core/ClassLoader.php @@ -162,9 +162,11 @@ class CRM_Core_ClassLoader { $file = strtr($class, '_', '/') . '.php'; // There is some question about the best way to do this. // "require_once" is nice because it's simple and throws - // intelligible errors. The down side is that autoloaders - // down the chain cannot try to find the file if we fail. - require_once $file; + // intelligible errors. + if (FALSE != stream_resolve_include_path($file)) { + require_once $file; + } } } + } -- 2.25.1