Are you using stock Docker compose setup? No

If not, either reproduce this issue on the official demo or switch to Docker and see if the issue is resolved. - It’s a code bug (I think) so reporting it here, hope that’s OK.


Describe the problem you’re having:

[Tue Mar 02 07:36:57.828377 2021] [proxy_fcgi:error] [pid 20237:tid 120432794420992] [client 192.168.0.120:7355] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'NOW()' for column `reader`.`ttrss_users`.`last_login` at row 1 in /var/www/reader/vendor/j4mie/idiorm/idiorm.php:505\nStack trace:\n#0 /var/www/reader/vendor/j4mie/idiorm/idiorm.php(505): PDOStatement->execute()\n#1 /var/www/reader/vendor/j4mie/idiorm/idiorm.php(2090): ORM::_execute('UPDATE `ttrss_u...', Array, 'default')\n#2 /var/www/reader/classes/userhelper.php(136): ORM->save()\n#3 /var/www/reader/index.php(21): UserHelper::login_sequence()\n#4 {main}\n  thrown in /var/www/reader/vendor/j4mie/idiorm/idiorm.php on line 505'
[Tue Mar 02 07:37:11.729760 2021] [proxy_fcgi:error] [pid 20237:tid 120432794420992] [client 192.168.0.109:45618] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'NOW()' for column `reader`.`ttrss_users`.`last_login` at row 1 in /var/www/reader/vendor/j4mie/idiorm/idiorm.php:505\nStack trace:\n#0 /var/www/reader/vendor/j4mie/idiorm/idiorm.php(505): PDOStatement->execute()\n#1 /var/www/reader/vendor/j4mie/idiorm/idiorm.php(2090): ORM::_execute('UPDATE `ttrss_u...', Array, 'default')\n#2 /var/www/reader/classes/userhelper.php(55): ORM->save()\n#3 /var/www/reader/classes/api.php(76): UserHelper::authenticate('admin', 'XqkKLa37h3eOoEo...', false, '_api')\n#4 /var/www/reader/api/index.php(55): API->login()\n#5 {main}\n  thrown in /var/www/reader/vendor/j4mie/idiorm/idiorm.php on line 505'

Include steps to reproduce the problem:

Be an annoying user, use MYSQL(!) on a legacy setup with PHP 7.3.27-1~deb10u1. Pull the latest version of tt-rss from git.

tt-rss version (including git commit id):

Latest commit: cd962dfa000f2da6ea0cc2c208c6061a3916ea85

Platform (i.e. Linux distro, PHP, PostgreSQL, etc) versions:

Debian 10, PHP 7.3.27-1~deb10u1, mysql Ver 15.1 Distrib 10.3.27-MariaDB, for debian-linux-gnu

Please provide any additional information below:

Contents of config.php:

<?php
        // *******************************************
        // *** Database configuration (important!) ***
        // *******************************************

        putenv('TTRSS_DB_TYPE=mysql');
        putenv('TTRSS_DB_HOST=localhost');
        putenv('TTRSS_DB_USER=reader');
        putenv('TTRSS_DB_NAME=reader');
        putenv('TTRSS_DB_PASS=<redacted>');
        putenv('TTRSS_MYSQL_CHARSET=UTF8');
        putenv('TTRSS_SELF_URL_PATH=https://reader.muppetz.com/');
        /* putenv('TTRSS_ENABLE_REGISTRATION=true'); */
        /* putenv('TTRSS_REG_NOTIFY_ADDRESS=tim@muppetz.com'); */
        /* putenv('TTRSS_REG_MAX_USERS=100'); */
        /* putenv('TTRSS_SESSION_COOKIE_LIFETIME=6998400'); */
        /* putenv('TTRSS_SMTP_FROM_NAME=Tiny Tiny RSS'); */
        /* putenv('TTRSS_SMTP_FROM_ADDRESS=reader@muppetz.com'); */
        /* putenv('TTRSS_DIGEST_SUBJECT=[tt-rss] New headlines for last 24 hours'); */
        /* putenv('TTRSS_SMTP_SERVER=mail.muppetz.com'); */
        /* putenv('TTRSS_SMTP_SECURE=tls'); */
        /* putenv('TTRSS_ENABLE_GZIP_OUTPUT=false'); */
        /* putenv('TTRSS_PLUGINS=auth_internal, note, digest, cache_starred_images'); */
        // vim:ft=php
?>

Fully understand if the response is: ‘You are using a totally unsupported setup, go away.’ Just thought I’d log it in case.

that’s from the ORM layer, can you post the actual full stacktrace or something that involves tt-rss code?

Looks like you may have forgotten to set the TTRSS_DB_PORT to one for mysql.

It defaults to the pgsql port.

i’m seeing a fatal error on login on mysql which is related to the ORM:

PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: 'NOW()' for column `postgres`.`ttrss_users`.`last_login` at row 1

the cause is userhelper.php line 54:

               $user->last_login = 'NOW()';

               $user->save();

this happens because apparently you can’t set timestamp to “NOW()” on mysql, you maybe need to give it an actual timestamp or something. it works just fine on postgres, obviously.

it’s interesting how pdo on mysql is just so shit. just like mysql itself, i guess.

Thanks - It was working prior to the latest commit without this, but for the avoidance of doubt I’ve also set this now.

I take it this is yet another nail in the coffin for mysql? I really should look at that Docker install again huh?

i dunno, but it’s always mysql that needs stupid workarounds while postgresql just works. maybe i’m just doing it wrong but it’s always the same story, again and again

this should hopefully deal with it:

https://git.tt-rss.org/fox/tt-rss/commit/031ee47a3e3de0d86fd5f951af3a136d85b387c5

it could be more correct to pass an actual timestamp as opposed to a function here, who knows.

And it does, thank you, I can read my feeds once again.
As always, appreciate your prompt response and willingness to deal with us mysql muppets.

Edit: I have made a tinytinydonation to say thanks.

https://idiorm.readthedocs.io/en/latest/models.html#properties-containing-expressions

this is how it’s supposed to be done, apparently. i had my doubts but then it just started working on postgres :man_shrugging: