From 7b61ba41bbd431bdfb0ef11aca41b893e33f5c20 Mon Sep 17 00:00:00 2001 From: tianhe1986 Date: Wed, 21 Jun 2017 19:17:23 +0800 Subject: Always check whether a model be a subclass of CI_Model when loaded. Signed-off-by: tianhe1986 --- system/core/Loader.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/core/Loader.php') diff --git a/system/core/Loader.php b/system/core/Loader.php index 7279e8833..e6585ad3f 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -344,9 +344,10 @@ class CI_Loader { throw new RuntimeException('Unable to locate the model you have specified: '.$model); } } - elseif ( ! is_subclass_of($model, 'CI_Model')) + + if ( ! is_subclass_of($model, 'CI_Model')) { - throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model"); + throw new RuntimeException("Class ".$model." doesn't extend CI_Model"); } $this->_ci_models[] = $name; -- cgit v1.2.3-24-g4f1b