Permalink
Browse files

In autoloader setup, use RuntimeException, and check class loading, n…

…ot file return value.
  • Loading branch information...
1 parent 720842f commit 9b69d43b934182f01b60702876065f18a9ba85a5 @mrclay mrclay committed Mar 24, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 engine/lib/autoloader.php
@@ -26,7 +26,7 @@ function _elgg_services() {
* We can't load this from dataroot because we don't know it yet, and we'll need
* several classes before we can find out!
*
- * @throws Exception
+ * @throws RuntimeException
* @access private
*/
function _elgg_create_service_provider() {
@@ -35,8 +35,9 @@ function _elgg_create_service_provider() {
foreach (array('Elgg_ClassMap', 'Elgg_ClassLoader', 'Elgg_AutoloadManager') as $class) {
if (!class_exists($class)) {
$file = "{$dir}/" . strtr($class, '_\\', '//') . ".php";
- if (!include $file) {
- throw new Exception("Could not load {$file}");
+ include $file;
+ if (!class_exists($class, false)) {
+ throw new RuntimeException("Could not load {$class} in {$file}.");
}
}
}

0 comments on commit 9b69d43

Please sign in to comment.