Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probleme de date /lib/classes/cache/databox.php #3148

Open
tomamplius opened this issue Aug 19, 2019 · 1 comment
Open

Probleme de date /lib/classes/cache/databox.php #3148

tomamplius opened this issue Aug 19, 2019 · 1 comment

Comments

@tomamplius
Copy link
Contributor

La version mysl de debian 10 (mariadb) n'accepte pas le format de date ISO8601 (ie https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_get-format)

Fonctionne sur une vielle version de debian 8
Server version: 5.5.62-0+deb8u1 (Debian)

mysql> UPDATE sitepreff SET memcached_update = '2019-08-19T15:49:39+0200';
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 1

Ne fonctionne plus sur debian 10

Server version: 5.5.5-10.3.15-MariaDB-1 Debian 10

mysql> UPDATE sitepreff SET memcached_update = '2019-08-19T15:49:39+0200';
ERROR 1292 (22007): Incorrect datetime value: '2019-08-19T15:49:39+0200' for column db_phrasea.sitepreff.memcached_update at row 1

Le code en cause est : /lib/classes/cache/databox.php 117 à 126

        $date = new \DateTime();
        $now = $date->format(DATE_ISO8601);
        $app->getApplicationBox()->set_data_to_cache($now, 'memcached_update_' . $sbas_id);
        $conn = $app->getApplicationBox()->get_connection();
        $sql = 'UPDATE sitepreff SET memcached_update = :date';
        $stmt = $conn->prepare($sql);
        $stmt->execute([':date' => $now]);

@tomamplius
Copy link
Contributor Author

I solve this issue with

        $date = new \DateTime();
        $now = $date->format(DATE_ISO8601);
        $app->getApplicationBox()->set_data_to_cache($now, 'memcached_update_' . $sbas_id);
        $conn = $app->getApplicationBox()->get_connection();
        $sql = 'UPDATE sitepreff SET memcached_update = current_timestamp()';
        $stmt = $conn->prepare($sql);
        $stmt->execute();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant