FS#73451 - [tt-rss] php 8.1 breaks stuff
Attached to Project:
Community Packages
Opened by Oleksandr Natalenko (post-factum) - Friday, 21 January 2022, 20:24 GMT
Last edited by Anatol Pomozov (anatolik) - Tuesday, 01 February 2022, 17:11 GMT
Opened by Oleksandr Natalenko (post-factum) - Friday, 21 January 2022, 20:24 GMT
Last edited by Anatol Pomozov (anatolik) - Tuesday, 01 February 2022, 17:11 GMT
|
Details
The following issue occurs after upgrading to php 8.1:
``` nginx[122339]: 2022/01/21 21:04:15 [error] 122339#122339: *572280 FastCGI sent in stderr: "PHP message: PHP Fatal error: During inheritance of ArrayAccess: Uncaught Error: Class "ORM" not found in /usr/share/webapps/tt-rss/classes/logger/sql.php:7 Stack trace: #0 /usr/share/webapps/tt-rss/classes/logger.php(62): Logger_SQL->__construct() #1 /usr/share/webapps/tt-rss/classes/logger.php(80): Logger->__construct() #2 /usr/share/webapps/tt-rss/classes/logger.php(32): Logger::get_instance() #3 /usr/share/webapps/tt-rss/include/errorhandler.php(60): Logger::log_error() #4 /usr/share/webapps/tt-rss/vendor/j4mie/idiorm/idiorm.php(115): ttrss_error_handler() #5 /usr/share/webapps/tt-rss/vendor/composer/ClassLoader.php(444): include('...') #6 /usr/share/webapps/tt-rss/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile() #7 /usr/share/webapps/tt-rss/classes/db.php(11): Composer\Autoload\ClassLoader->loadClass() #8 /usr/share/webapps/tt-rss/classes/db.php(82): Db->__construct() #9 /usr/share/webapps/tt-rss/classes/db/migrations.php(33): Db::pdo() #10 /usr/share/webapps/tt-rss/clas...PHP message: PHP Fatal error: Uncaught Error: Class "ORM" not found in /usr/share/webapps/tt-rss/classes/logger/sql.php:7 Stack trace: #0 /usr/share/webapps/tt-rss/classes/logger.php(62): Logger_SQL->__construct() #1 /usr/share/webapps/tt-rss/classes/logger.php(80): Logger->__construct() #2 /usr/share/webapps/tt-rss/classes/logger.php(32): Logger::get_instance() #3 /usr/share/webapps/tt-rss/include/errorhandler.php(81): Logger::log_error() #4 [internal function]: ttrss_fatal_handler() #5 {main} thrown in /usr/share/webapps/tt-rss/classes/logger/sql.php on line 7" while reading response header from upstream, client: 1.2.3.4, server: rss.example.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/…/sock:", host: "rss.example.com" ``` Looks like `j4mie/idiorm` vendor component is not compatible with 8.1 [1]. There's a workaround, as per [2], which is to annotate `ArrayAccess` class methods with `#[\ReturnTypeWillChange]`. I've tried this workaround, and it seems it works, but I have no idea if it is a correct approach. Probably, Arch should carry a small patch since it seems that stuff is not actively maintained in upstream. [1] https://github.com/j4mie/idiorm/issues/371 [2] https://github.com/j4mie/idiorm/pull/370 |
This task depends upon
Closed by Anatol Pomozov (anatolik)
Tuesday, 01 February 2022, 17:11 GMT
Reason for closing: Fixed
Additional comments about closing: tt-rss-2:r11220.b59bde7b4-1
Tuesday, 01 February 2022, 17:11 GMT
Reason for closing: Fixed
Additional comments about closing: tt-rss-2:r11220.b59bde7b4-1
[1] https://community.tt-rss.org/t/support-for-php-8-1/5089
[1] https://php.watch/versions/8.1/internal-method-return-types
vendor/j4mie/idiorm/idiorm.php:2405 IdiormResultSet implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)
classes/debug.php:91 Function strftime() is deprecated
1. classes/debug.php(91): ttrss_error_handler(Function strftime() is deprecated, classes/debug.php)
2. classes/article.php(480): log(Purged 0 orphaned posts.)
3. classes/rssutils.php(1663): _purge_orphans()
4. update.php(253): housekeeping_common()
It worth updating tt-rss anyway
Note that I'm reverting the reverted commit.
I believe the reason if was reverted upstream is due to php 7 incompatibility. But we don't care about php 7.
This works for me.
Umm. I'm familiar with PHP to some extent, but maintaining a fork of some random outdated stuff is not really my priority, sorry :).
The revert of upstream's revert works fine for me, so I'll stick to it. Thank you.
Here is a draft PKGBUILD: https://fars.ee/Xyu_ I use `git revert` instead of downloading patches. Just a personal taste :)
Pushed tt-rss-2:r11216.56fd06d61-2-any.pkg.tar.zst to testing. Please verify that it works as expected.
> After upgrade, clicking on element, doesn't mark article as read.
I manually mark an article as unread and clicking it turns it into read again. Maybe the issue is something other than PHP 8.1; the updated package in Arch involves not only PHP 8.1 patches but also the latest git commits from upstream.
Yeah I see it as well. It looks like an upstream issue and need to be reported/fixed there.
Do you use MySQL as database? I found a workaround in the code that tests for mysql and works around the problem that MySQL does not know about boolean values.
In my MySQL instance the values in the database weren't strings anymore but integers instead, so I added a switch to check for integers.
still have many read items that got marked unread now...
also got duplicates
[1] https://community.tt-rss.org/t/feed-entries-wrongly-shown-as-read-on-php-8-1/5203
[2] https://git.tt-rss.org/fox/tt-rss/pulls/65
```sql
DELETE f2 FROM ttrss_entries f1 INNER JOIN ttrss_entries f2
WHERE f1.id < f2.id AND f1.link = f2.link;
```
You could use other fields in the later condition. i removed the newer dublicates as the old ones was read and the new unread. you could replace f2 with f1 at the start to remove the older entries if you wish for it.