Issue Bug Closed

#91204Migrates existing sys_log entries into sys_history fails sometimes

Kurt Gusbeth 04/27/20, 10:57 updated 10/04/22, 14:00

Description

We had/have sometimes problems to extecute the Upgrade wizard
Migrates existing sys_log entries into sys_history
sucessfully. It breaks down. Even when the db-table sys_log is empty it is not working alwaly.
Current error message (TYPO3 9.5.15):

Whoops, looks like something went wrong.
(1/1) TypeError

Argument 4 passed to TYPO3\CMS\Install\Updates\SeparateSysHistoryFromSysLogUpdate::updateTablesAndTrackProgress() must be of the type array, boolean given, called in /html/typo3-dev/typo3_src-9.5.15/typo3/sysext/install/Classes/Updates/SeparateSysHistoryFromSysLogUpdate.php on line 195

Because it happens again and again, someone should fix this bug!

Reviews 1

History 78

  1. Kurt Gusbeth commented 04/27/20, 11:04

    The install tool seems to create entries in sys_log too. When I delete them just before executing this wizard on an empty sys_log table
    the wizard is working without an error.

  2. Paul Beck commented 04/28/20, 10:33

    I can confirm this issue.. It happens when sys_log`s DB entries have an empty log_data field which cannot be unserialize() in line 172 of SeparateSysHistoryFromSysLogUpdate.php

  3. Franz Holzinger commented 10/10/20, 10:29

    This error still happens in TYPO3 9.5.22.

     TypeError
    
    Argument 4 passed to TYPO3\CMS\Install\Updates\SeparateSysHistoryFromSysLogUpdate::updateTablesAndTrackProgress() must be of the type array, boolean given, called in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/install/Classes/Updates/SeparateSysHistoryFromSysLogUpdate.php on line 195
    in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/install/Classes/Updates/SeparateSysHistoryFromSysLogUpdate.php line 242
    
         * @param array $logData
         * @param array $row
         * @return array
         */
        protected function updateTablesAndTrackProgress(
            Connection $connection,
            Connection $connectionForSysRegistry,
            array $updateData,
            array $logData,
    
    at TYPO3\CMS\Install\Updates\SeparateSysHistoryFromSysLogUpdate->updateTablesAndTrackProgress(object(TYPO3\CMS\Core\Database\Connection), object(TYPO3\CMS\Core\Database\Connection), array('actiontype' => 2, 'usertype' => 'BE', 'userid' => 2, 'sys_log_uid' => 0, 'history_data' => '{"oldRecord":{"config":"\\r\\ntemp.submenu {\\r\\n 10 {\\r\\n value =\\r\\n wrap = <div class=\\"submenu\\"> | <\\/div>\\r\\n }\\r\\n}\\r\\n\\r\\ntemp.logo {\\r\\n 20 {\\r\\n\\tfile.width = 500\\r\\n }\\r\\n 30 = TEXT\\r\\n 30 {\\r\\n wrap = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\\r\\n }\\r\\n 40 = IMAGE\\r\\n 40 {\\r\\n file = {$mastertemplate.path}\\/images\\/typo3logo.gif\\r\\n wrap=<a href=\\"http:\\/\\/www.typo3.org\\">|<\\/a>\\r\\n }\\r\\n}\\r\\n\\r\\ntemp.right {\\r\\n 5 = CONTENT \\r\\n 5 {\\r\\n table = tt_content\\r\\n select {\\r\\n orderBy = sorting\\r\\n pidInList = 17\\r\\n where = colPos = 0\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n<INCLUDE_TYPOSCRIPT: source=\\"FILE: EXT:mastertemplate\\/static\\/setup.txt\\">\\r\\n\\r\\n"},"newRecord":{"config":"\\r\\ntemp.submenu {\\r\\n 10 {\\r\\n value =\\r\\n wrap = <div class=\\"submenu\\"> | <\\/div>\\r\\n }\\r\\n}\\r\\n\\r\\ntemp.logo {\\r\\n 20 {\\r\\n\\tparams = style=\\"margin: 0px 20px;\\"\\r\\n\\tfile.width = 500\\r\\n }\\r\\n 30 = TEXT\\r\\n 30 {\\r\\n wrap = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\\r\\n }\\r\\n 40 = IMAGE\\r\\n 40 {\\r\\n file = {$mastertemplate.path}\\/images\\/typo3logo.gif\\r\\n wrap=<a href=\\"http:\\/\\/www.typo3.org\\">|<\\/a>\\r\\n }\\r\\n}\\r\\n\\r\\ntemp.right {\\r\\n 5 = CONTENT \\r\\n 5 {\\r\\n table = tt_content\\r\\n select {\\r\\n orderBy = sorting\\r\\n pidInList = 17\\r\\n where = colPos = 0\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n<INCLUDE_TYPOSCRIPT: source=\\"FILE: EXT:mastertemplate\\/static\\/setup.txt\\">\\r\\n\\r\\n"}}', 'originaluserid' => null), false, array('history_uid' => 1422, 'history_data' => 'a:2:{s:9:"oldRecord";a:1:{s:6:"config";s:599:" temp.submenu { 10 { value = wrap = <div class="submenu"> | </div> } } temp.logo { 20 { file.width = 500 } 30 = TEXT 30 { wrap = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 40 = IMAGE 40 { file = {$mastertemplate.path}/images/typo3logo.gif wrap=<a href="http://www.typo3.org">|</a> } } temp.right { 5 = CONTENT 5 { table = tt_content select { orderBy = sorting pidInList = 17 where = colPos = 0 } } } <INCLUDE_TYPOSCRIPT: source="FILE: EXT:mastertemplate/static/setup.txt"> ";}s:9:"newRecord";a:1:{s:6:"config";s:636:" temp.submenu { 10 { value = wrap = <div class="submenu"> | </div> } } temp.logo { 20 { params = style="margin: 0px 20px;" file.width = 500 } 30 = TEXT 30 { wrap = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 40 = IMAGE 40 { file = {$mastertemplate.path}/images/typo3logo.gif wrap=<a href="http://www.typo3.org">|</a> } } temp.right { 5 = CONTENT 5 { table = tt_content select { orderBy = sorting pidInList = 17 where = colPos = 0 } } } <INCLUDE_TYPOSCRIPT: source="FILE: EXT:mastertemplate/static/setup.txt"> ";}}', 'uid' => 311, 'userid' => 2, 'action' => 0, 'recuid' => 0, 'tablename' => '', 'recpid' => 0, 'error' => 2, 'details' => 'Core: Exception handler (WEB): Uncaught TYPO3 Exception: Using $this when not in object context | Error thrown in file /home/www/doc/path/typo3conf/ext/tt_products/Classes/Api/BasketApi.php in line 71. Requested URL: http://neu.ttproducts.de/index.php?id=tt_products_ext', 'tstamp' => 1526473079, 'type' => 5, 'details_nr' => 0, 'IP' => '89.0.250.199', 'log_data' => '', 'event_pid' => -1, 'workspace' => 0, 'NEWid' => '', 'pid' => 0, 'request_id' => '', 'time_micro' => 0.0, 'component' => '', 'level' => 0, 'message' => null, 'data' => null))
    in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/install/Classes/Updates/SeparateSysHistoryFromSysLogUpdate.php line 195
    
                                $connection,
                                $connection,
                                $updateData,
                                $logData,
                                $row
                            );
                            $connection->commit();
                        } catch (\Exception $up) {
                            $connection->rollBack();
    
    at TYPO3\CMS\Install\Updates\SeparateSysHistoryFromSysLogUpdate->moveDataFromSysLogToSysHistory(object(TYPO3\CMS\Core\Database\Connection), object(TYPO3\CMS\Core\Database\Connection), array('phase' => 0, 'uid' => 1421))
    in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/install/Classes/Updates/SeparateSysHistoryFromSysLogUpdate.php line 125
    
            if ($startPositionAndPhase['phase'] === self::MOVE_DATA) {
                $startPositionAndPhase = $this->moveDataFromSysLogToSysHistory(
                    $connection,
                    $connectionForSysRegistry,
                    $startPositionAndPhase
                );
            }
    
            if ($startPositionAndPhase['phase'] === self::UPDATE_HISTORY) {
    
    at TYPO3\CMS\Install\Updates\SeparateSysHistoryFromSysLogUpdate->executeUpdate()
    in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/install/Classes/Service/UpgradeWizardsService.php line 397
    
                            $performResult = true;
                        }
                    } else {
                        // confirmation yes or non-confirmable
                        $performResult = $updateObject->executeUpdate();
                    }
                }
    
                $stream = $this->output->getStream();
    
    at TYPO3\CMS\Install\Service\UpgradeWizardsService->executeWizard('separateSysHistoryFromLog')
    in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/install/Classes/Controller/UpgradeController.php line 1000
    
            // ext_localconf, db and ext_tables must be loaded for the updates :(
            $this->loadExtLocalconfDatabaseAndExtTables();
            $upgradeWizardsService = new UpgradeWizardsService();
            $identifier = $request->getParsedBody()['install']['identifier'];
            $messages = $upgradeWizardsService->executeWizard($identifier);
            return new JsonResponse([
                'success' => true,
                'status' => $messages,
            ]);
    
    at TYPO3\CMS\Install\Controller\UpgradeController->upgradeWizardsExecuteAction(object(TYPO3\CMS\Core\Http\ServerRequest))
    in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/install/Classes/Http/RequestHandler.php line 221
    
                        'Unknown action method ' . $action . ' in controller ' . $controllerName,
                        1505216027
                    );
                }
                $response = $controller->$action($request);
            }
    
            return $response;
        }
    
    at TYPO3\CMS\Install\Http\RequestHandler->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
    in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/install/Classes/Http/Application.php line 65
    
        {
            $this->initializeContext();
            foreach ($this->availableRequestHandlers as $handler) {
                if ($handler->canHandleRequest($request)) {
                    return $handler->handle($request)
                        ->withHeader('X-Frame-Options', 'SAMEORIGIN');
                }
            }
            throw new \TYPO3\CMS\Core\Exception('No suitable request handler found.', 1518448686);
    
    at TYPO3\CMS\Install\Http\Application->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
    in /home/www/doc/path/typo3_src-9.5.22/typo3/sysext/core/Classes/Http/AbstractApplication.php line 120
    
        final public function run(callable $execute = null)
        {
            try {
                $response = $this->handle(
                    \TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals()
                );
                if ($execute !== null) {
                    call_user_func($execute);
                }
    
    at TYPO3\CMS\Core\Http\AbstractApplication->run()
    in /home/www/doc/path/typo3_src-9.5.22/typo3/install.php line 104
    
    call_user_func(function () {
        $classLoader = require dirname(__DIR__).'/vendor/autoload.php';
        \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_INSTALL);
        \TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Install\Http\Application::class)->run();
    });
    
    at {closure}()
    in /home/www/doc/path/typo3_src-9.5.22/typo3/install.php line 105
    
    call_user_func(function () {
        $classLoader = require dirname(__DIR__).'/vendor/autoload.php';
        \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_INSTALL);
        \TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Install\Http\Application::class)->run();
    });
  4. Gerrit Code Review pushed patch set 1 for 10.4 to change 73858 status New Under Review 03/08/22, 16:03

  5. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % 03/15/22, 16:20

    Applied in changeset commit:29c832d76421f063813886b73e8e84603b91a3ed.

  6. Sebastien Michel commented 08/22/22, 19:04

    Benni Mack wrote in #note-5:
    > Applied in changeset commit:29c832d76421f063813886b73e8e84603b91a3ed.

    Anyone knows how-to backport this patch in branch 9?

  7. Sebastien Michel commented 08/30/22, 22:08

    Note : Don’t understand why this ticket was marked as resolved as branch 9 was not patched.

    If branch 9 was not patched, can we skip that update when moving to branch 9 and do it only when moving to branch 10? I have a couple of installs to migrate from TYPO3 8 to 10. Thanks!

  8. Benni Mack changed status Resolved Closed 10/04/22, 14:00