Closed bramley closed 3 months ago
Haven't tested it, but looking at the code looks fine.
This pull request has been mentioned on phpList Discuss. There might be relevant details there:
https://discuss.phplist.org/t/3-6-15-release-candidate-is-available-for-testing/9473/1
This pull request has been mentioned on phpList Discuss. There might be relevant details there:
https://discuss.phplist.org/t/phplist-3-6-15-has-been-released/9495/1
Description
As explained in #1015 prior to MySQL 8 when a phplist database was created timestamp columns were implicitly given a default of
current_timestamp
andon update current_timestamp
. This was due to the default value forexplicit_defaults_for_timestamp
being OFF.In MySQL 8 the default changed to ON, which means any databases created with MySQL 8, or MariaDB 10.5, have had timestamp columns created incorrectly leading to null values in those columns.
This PR changes the definitions of timestamp columns to be explicit so that new databases will be created correctly.
For existing databases, any affected columns that have null values are updated to have a valid value. The choices here only seem to be to copy a "created" value if one exists or to use the time of applying the update. The timestamp columns are then changed to have the required definition.
For clarity any places in the code that explicitly set a timestamp column to now() have been removed. There is one place, in processbounces.php that sets a timestamp to a different value, the date/time of a bounce. This has been untouched. The linktrack table has not been changed as it is now read-only.
Related Issue
1015
Screenshots (if appropriate):