Issue Bug Closed

#70629Bug with MySQL mode STRICT_TRANS_TABLES

Markus Hölzle 10/12/15, 17:27 updated 10/30/15, 21:05

Description

Hello,

there is a bug if the MySQL mode “STRICT_TRANS_TABLES” is enabled: The function saveTask($task) for example tries to store TRUE or FALSE to a TINYINT database field ‘disabled’. This throws an error in the strict mode, because TINYINT only accepts integer values.

The consequences are massive: The scheduler doesn’t save the ‘nextexecution’ field and ignores the error. Then the scheduler starts the next (= the same) task immediately because the ‘nextexecution’ isn’t in the feature… So we have a endless loop, and this will be started by the unix cron command every minute… In worst case, this works until the server crashes!

So this line should be changed from

 241             $fields = array(
 242                 'nextexecution' => $executionTime,
 243                 'disable' => $task->isDisabled(),
 244                 'description' => $task->getDescription(),
 245                 'task_group' => $task->getTaskGroup(),
 246                 'serialized_task_object' => serialize($task)
 247             );
 248             $result = $this->getDatabaseConnection()->exec_UPDATEquery('tx_scheduler_task', 'uid = ' . $taskUid, $fields);

to

 241             $fields = array(
 242                 ...
 243                 'disable' => $task->isDisabled() === TRUE ? 1 : 0,
 244                 ...
 247             );

What do you think?
This kind of saving data is often found in this extension…

Best regards,
Markus

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.