{"record":{"id":"142a768d02241437","repo":"bcit-ci/CodeIgniter","slug":"class-php-exists-but-doesn-t-declare-class-clas","errorCode":null,"errorMessage":"$class.php exists, but doesn't declare class $class","messagePattern":"\\$class\\.php exists, but doesn't declare class \\$class","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/core/Loader.php","lineNumber":328,"sourceCode":"\t\t\t\tif ( ! class_exists('CI_Model', FALSE))\n\t\t\t\t{\n\t\t\t\t\tthrow new RuntimeException($app_path.\"Model.php exists, but doesn't declare class CI_Model\");\n\t\t\t\t}\n\n\t\t\t\tlog_message('info', 'CI_Model class loaded');\n\t\t\t}\n\t\t\telseif ( ! class_exists('CI_Model', FALSE))\n\t\t\t{\n\t\t\t\trequire_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php');\n\t\t\t}\n\n\t\t\t$class = config_item('subclass_prefix').'Model';\n\t\t\tif (file_exists($app_path.$class.'.php'))\n\t\t\t{\n\t\t\t\trequire_once($app_path.$class.'.php');\n\t\t\t\tif ( ! class_exists($class, FALSE))\n\t\t\t\t{\n\t\t\t\t\tthrow new RuntimeException($app_path.$class.\".php exists, but doesn't declare class \".$class);\n\t\t\t\t}\n\n\t\t\t\tlog_message('info', config_item('subclass_prefix').'Model class loaded');\n\t\t\t}\n\t\t}\n\n\t\t$model = ucfirst($model);\n\t\tif ( ! class_exists($model, FALSE))\n\t\t{\n\t\t\tforeach ($this->_ci_model_paths as $mod_path)\n\t\t\t{\n\t\t\t\tif ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\trequire_once($mod_path.'models/'.$path.$model.'.php');\n\t\t\t\tif ( ! class_exists($model, FALSE))","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/bcit-ci/CodeIgniter/blob/3658d731eaabe6117298a105ffb5b9dd59e190ce/system/core/Loader.php#L310-L346","documentation":"Error \"$class.php exists, but doesn't declare class $class\" thrown in bcit-ci/CodeIgniter.","triggerScenarios":"Thrown at system/core/Loader.php:328 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3658d731eaabe6117298a105ffb5b9dd59e190ce","analyzedAt":"2026-08-17T02:34:56.929Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}