diff --git a/core/DataTable/Renderer.php b/core/DataTable/Renderer.php index 6fd073d5fbd751e48a7f6d3093fdadf0aa71b909..84efd8c935b45e3068ad8782f199adefeb5b0850 100644 --- a/core/DataTable/Renderer.php +++ b/core/DataTable/Renderer.php @@ -117,7 +117,7 @@ abstract class Piwik_DataTable_Renderer $className = 'Piwik_DataTable_Renderer_' . $name; try { - Piwik_Loader::autoload($className); + Piwik_Loader::loadClass($className); return new $className; } catch(Exception $e) { $availableRenderers = implode(', ', self::getRenderers()); @@ -135,4 +135,4 @@ abstract class Piwik_DataTable_Renderer { return htmlentities($rawData, ENT_COMPAT, "UTF-8"); } -} \ No newline at end of file +} diff --git a/core/Loader.php b/core/Loader.php index bb4a04be35e972171fc52e631ea3017033f41cf5..b6d24e2b7bb26818f44333ac1830cc2c0aa906de 100644 --- a/core/Loader.php +++ b/core/Loader.php @@ -47,8 +47,9 @@ class Piwik_Loader * Load class by name * * @param string $class Class name + * @throws Exception if class not found */ - public static function autoload($class) + public static function loadClass($class) { $classPath = self::getClassFileName($class); while(!empty($classPath)) @@ -71,6 +72,20 @@ class Piwik_Loader $lastSlash = strrpos($classPath, '/'); $classPath = ($lastSlash === false) ? '' : substr($classPath, 0, $lastSlash); } + throw new Exception("Class \"$class\" not found."); + } + + /** + * Autoloader + * + * @param string $class Class name + */ + public static function autoload($class) + { + try { + @self::loadClass($class); + } catch (Exception $e) { + } } } diff --git a/core/Session.php b/core/Session.php index 49969f2066113cd7722e16c46e6c885dccd1318c..490e1b2ce57d8e253412262fef144d9180c37500 100644 --- a/core/Session.php +++ b/core/Session.php @@ -67,6 +67,11 @@ class Piwik_Session extends Zend_Session } } - Zend_Session::start(); + try { + Zend_Session::start(); + } catch(Exception $e) { + // This message is not translateable because translations haven't been loaded yet. + Piwik_ExitWithMessage('Unable to start session. Check that session.save_path or tmp/sessions is writeable.'); + } } }