From a1868b997c7677d24bc2a905da991facb2a493b0 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Tue, 10 Jan 2012 01:30:37 +0000 Subject: [PATCH] Stop autoloader after loading subclass exceptions if the required class was found --- source/lib/SihnonFramework/Main.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/lib/SihnonFramework/Main.class.php b/source/lib/SihnonFramework/Main.class.php index db65c29..2ecb101 100644 --- a/source/lib/SihnonFramework/Main.class.php +++ b/source/lib/SihnonFramework/Main.class.php @@ -199,6 +199,10 @@ class SihnonFramework_Main { $exceptions_filename = /*$class['subclass_dir_prefix'] .*/ preg_replace('/_/', '/', $matches[1]) . 'Exceptions.class.php'; if (stream_resolve_include_path($exceptions_filename)) { require_once($exceptions_filename); + // If that found the class, break here, otherwise look upstream + if (class_exists($classname, false)) { + return; + } } else { // Create this class to extend the Framework parent $parent_classname = preg_replace("/^{$class['subclass']}_/", "{$class['base']}_", $classname);