Error while saving cron execution into cron history.
Description
When a cron gets executed via console (without active user) an error occurs, if the MySql strict mode is enabled.
The Manager tries to grab the current users ID and save it into the database.
If there is no active user, the manager tries to save an empty value into the database, which is not allowed with the strict mode enabled.
Therefore the cron does not get saved and gets executed every minute.
Reproduction
Enable strict mode and one cron.
Expected behavior
The cron should get saved into the cron_history table properly
Actual behavior
The cron does not get saved and gets executed every minute
Error message
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'uid' at row 1Array
(
[query] => INSERT INTO `cron_history` SET `cronid` = :setv0, `lastexec` = :setv1, `uid` = :setv2
[prepare] => Array
(
[setv0] => 9
[setv1] => 2019-01-03 15:12:02
[setv2] =>
)
)