[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 14:52:55 +0000 (15:52 +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: Iaf80515f54d35bd09f1c78e7f69e671044e203af
Resolves: #33116
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/8747
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_autoloader.php
typo3/sysext/scheduler/class.tx_scheduler_module.php

index ab41c11..80fdbb0 100644 (file)
@@ -67,6 +67,7 @@ class t3lib_autoloader {
         */
        public static function registerAutoloader() {
                self::loadCoreAndExtensionRegistry();
+               @ini_set('unserialize_callback_func', 'spl_autoload_call');
                return spl_autoload_register('t3lib_autoloader::autoload', TRUE, TRUE);
        }
 
index 7d0ef75..6818bdf 100644 (file)
@@ -1134,7 +1134,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                                                        /** @var $exception Exception */
                                                $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());