[BUGFIX] Scheduler BE module fails to load due to autoloader issues
authorDmitry Dulepov <dmitry@typo3.org>
Wed, 11 Jan 2012 12:15:00 +0000 (14:15 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 28 Jan 2012 15:07:58 +0000 (16:07 +0100)
When displaying a list of tasks, scheduler unserializes exceptions.
By default, unserialize() does not call autoloader to load classes
and it is possible that the exception class will not be loaded. In
such case scheduler BE module will fail with a PHP fatal error
when the scheduler will try to use a _PHP_Incomplete_Class.

The fix makes sure that autoloader is called during unserialize().
However this still may fail, so the scheduler now checks that the
exception is loaded properly before trying to use it.

Change-Id: I12188324ad133752a0c0eb77c4905ed1854197b7
Resolves: #33116
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/8748
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_autoloader.php
typo3/sysext/scheduler/mod1/index.php

index d9a7672..9bd6854 100644 (file)
@@ -75,6 +75,7 @@ class t3lib_autoloader {
        static public function registerAutoloader() {
                self::loadCoreRegistry();
                self::$extensionHasAutoloadConfiguration = array();
+               @ini_set('unserialize_callback_func', 'spl_autoload_call');
                return spl_autoload_register('t3lib_autoloader::autoload');
        }
 
index 2b53678..1d96756 100755 (executable)
@@ -1147,7 +1147,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                                                        // Try to get the stored exception object
                                                $exception = unserialize($schedulerRecord['lastexecution_failure']);
                                                        // If the exception could not be unserialized, issue a default error message
-                                               if ($exception === FALSE) {
+                                               if ($exception === FALSE || ($exception instanceof __PHP_Incomplete_Class)) {
                                                        $failureDetail = $GLOBALS['LANG']->getLL('msg.executionFailureDefault');
                                                } else {
                                                        $failureDetail = sprintf($GLOBALS['LANG']->getLL('msg.executionFailureReport'), $exception->getCode(), $exception->getMessage());