stopped working with php82-8.2.18

by snak-pak, Saturday, May 18, 2024, 22:05 (32 days ago)

I've been using Selfoss for many years now and love it. Unfortunately it suddenly stopped working. The only change on my side has been an upgrade from an early version of php 8.2.x to php 8.2.18. I'm getting database connection errors with both sqlite and mysql that look like this in the log:

[2024-05-18T19:33:42.850580+00:00] selfoss.ERROR: SQLSTATE[HY000]: General error: 1360 Trigger does not exist {"exception":"[object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 1360 Trigger does not exist at /usr/local/www/nginx/mywebsite.com/src/helpers/DatabaseConnection.php:140)

I was using sqlite so I switched to mysql to test things and got the same error, yet when I check mysql from the shell the database connection did in fact work and tables got created in a fresh new database, despite seeing the above error.

My main setup is Nginx with PHP-FPM but I've also tested it with Apache24 and mod_php and got the same error, both are running php 8.2.18 now. I also tested both sqlite and mysql on the two different systems with the same result. I read through the PHP changelog and didn't find much of interest with any sqlite updates, just a few changes to PDO since 8.2.0 came out.

My Nginx system runs about two dozen websites, most use mysql with php-fpm and they all work fine. I can connect through sockets or over IP.

I've tried the latest Selfoss builds on Github as well as older Github builds from late 2023. Thought I'd ask here before abandoning the software and trying something else.

Maybe I'm just losing my mind. Happy to switch to another version of PHP to get it working again.

stopped working with php82-8.2.18

by jtojnar, Monday, May 20, 2024, 02:42 (30 days ago) @ snak-pak

Hi, sorry about that.

If it started happening suddenly, that sounds like the database got corrupted or gotten to inconsistent state somehow. But selfoss only really modifies triggers when it is updated to a new version, and it stores the info that it performed a migration step in the database itself, so I am baffled how it could happen.

[2024-05-18T19:33:42.850580+00:00] selfoss.ERROR: SQLSTATE[HY000]: General error: 1360 Trigger does not exist {"exception":"[object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 1360 Trigger does not exist at /usr/local/www/nginx/mywebsite.com/src/helpers/DatabaseConnection.php:140)

Actually, you are not the first person experiencing this. It was reported on GitHub.

You should be able to work around it by replacing DROP TRIGGER with DROP TRIGGER IF EXISTS on the the following lines:

https://github.com/fossar/selfoss/blob/d45cba4a8013e0c50cdd583da9ca8e0aa5516d75/src/daos/mysql/Database.php#L241-L242

Also, are you sure SQLite complains about the trigger not existing? We are not even touching the existing trigger in SQLite – instead we create a new table from scratch.

I was using sqlite so I switched to mysql to test things and got the same error, yet when I check mysql from the shell the database connection did in fact work and tables got created in a fresh new database, despite seeing the above error.

If you are willing to debug this, I would appreciate the following info:

  • Can you check what the version table contains. That will tell us how far along it got in the database schema migration step.
  • Could you also share the lines in the log below [stacktrace] of the original error?
  • What version of MySQL server are you running?
  • Adding debug=1 and logger_level=DEBUG to your config in latest selfoss and trying with a clean database might be also helpful.
RSS Feed of thread
powered by my little forum