Bug #90220

Scheduler results in exception when used with sqlite

Added by Daniel Siepmann 9 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2020-01-27
Due date:
% Done:

100%

TYPO3 Version:
10
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Opening the scheduler module in TYPO3 Backend results in the following error:

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception

PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/daniels/Projects/own/website-typo3/project/private/typo3/sysext/scheduler/Classes/Scheduler.php line 130

The database entry is:

***************************[ 1. row ]***************************
uid                    | 3
crdate                 | 1580142884
disable                | 0
deleted                | 0
description            | 
nextexecution          | 1580146200
lastexecution_time     | 1580143156
lastexecution_failure  | 
lastexecution_context  | BE
serialized_task_object | O:45:"TYPO3\CMS\Reports\Task\SystemStatusUpdateTask":11:{s:20:"^@*^@notificationEmail";s:25:"***@example.com";s:18:"^@*^@notificationAll";b:0;s:12:"^@*^@schedul er";N;s:10:"^@*^@taskUid";i:3;s:11:"^@*^@disabled";b:0;s:19:"^@*^@runOnNextCronJob";b:0;s:12:"^@*^@execution";O:29:"TYPO3\CMS\Scheduler\Execution":6:{s:8:"^@*^@start";i:1580142861;s:6:"^@*^@end"; s:0:"";s:11:"^@*^@interval";i:0;s:11:"^@*^@multiple";s:1:"0";s:10:"^@*^@cronCmd";s:10:"30 * * * *";s:23:"^@*^@isNewSingleExecution";b:0;}s:16:"^@*^@executionTime";i:1580146200;s:14:"^@*^@descript ion";s:0:"";s:12:"^@*^@taskGroup";i:1;s:9:"^@*^@logger";N;}
serialized_executions  | 
task_group             | 1
(Escaped email, leading to invalid serialization above)

And structure:

+-----+------------------------+-------------------+---------+------------+----+
| cid | name                   | type              | notnull | dflt_value | pk |
+-----+------------------------+-------------------+---------+------------+----+
| 0   | uid                    | INTEGER           | 1       | <null>     | 1  |
| 1   | crdate                 | INTEGER UNSIGNED  | 1       | 0          | 0  |
| 2   | disable                | SMALLINT UNSIGNED | 1       | 0          | 0  |
| 3   | deleted                | SMALLINT UNSIGNED | 1       | 0          | 0  |
| 4   | description            | CLOB              | 0       | NULL       | 0  |
| 5   | nextexecution          | INTEGER UNSIGNED  | 1       | 0          | 0  |
| 6   | lastexecution_time     | INTEGER UNSIGNED  | 1       | 0          | 0  |
| 7   | lastexecution_failure  | CLOB              | 0       | NULL       | 0  |
| 8   | lastexecution_context  | VARCHAR(3)        | 1       | ''         | 0  |
| 9   | serialized_task_object | BLOB              | 0       | NULL       | 0  |
| 10  | serialized_executions  | BLOB              | 0       | NULL       | 0  |
| 11  | task_group             | INTEGER UNSIGNED  | 1       | 0          | 0  |
+-----+------------------------+-------------------+---------+------------+----+

at count(false)
in /home/daniels/Projects/own/website-typo3/project/private/typo3/sysext/scheduler/Classes/Scheduler.php line 130

}
}
}
$executionCount = count($executions);
if (count($serialized_executions) !== $executionCount) {
// if (is_array($serialized_executions) && count($serialized_executions) !== $executionCount) {
if ($executionCount === 0) {
$value = '';
} else {


Related issues

Related to TYPO3 Core - Bug #89697: Scheduler writes invalid 'serialized_task_object' to database Closed 2019-11-17

Associated revisions

Revision bb473171 (diff)
Added by Daniel Siepmann 8 months ago

[BUGFIX] Prevent PHP Warning for count() in scheduler for sqlite

As serialized_executions might be false instead of an array, check type
first. This ensures there will be no php warning

Resolves: #90220
Releases: master
Change-Id: Ic0bf283cc2ab93b6718b491452d431b5d63114bf
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63234
Reviewed-by: Oliver Klee <>
Reviewed-by: Susanne Moog <>
Reviewed-by: Daniel Goerz <>
Tested-by: TYPO3com <>
Tested-by: Susanne Moog <>
Tested-by: Daniel Goerz <>

History

#1 Updated by Gerrit Code Review 9 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63234

#2 Updated by Gerrit Code Review 9 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63234

#3 Updated by Daniel Siepmann 8 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#4 Updated by Susanne Moog 7 months ago

  • Related to Bug #89697: Scheduler writes invalid 'serialized_task_object' to database added

#5 Updated by Benni Mack 7 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF