Support for PHP8 and saying farewell to PHP 5.6

I think it’s time to finally drop PHP 5.6 and start requiring PHP 7 (released 2015). Working around PHP 8 E_WARNING changes in a readable manner is a good enough excuse for me.

First changeset with PHP8 changes is available for testing here:

https://git.tt-rss.org/fox/tt-rss/src/branch/wip-php8

Docker setup is here:

https://git.tt-rss.org/fox/ttrss-docker-compose/src/branch/dynamic-php8

Many leftover warnings are likely there still but their amount shouldn’t be overwhelming anymore. I’ve also fixed several minor bugs while I was at it, largely thanks to new and improved warnings.

One note that al2gt() and in general accept-to-gettext.php is frankly a pile of shit. I don’t really want to rewrite the entirety of it, so translation language guessing is currently limited to PHP7.

Unless there are major problems, expect this being merged soon™. If you’re still using PHP 5, well, too bad.

I’m generally satisfied with how this is turning out so expect master merge sometime early next week.

I’ve been using both branches for a bit and haven’t ran into any issues.

Master merge has happened.

https://git.tt-rss.org/fox/tt-rss/compare/983a874ddd140a2208482a342d333edfe3633b28...3aada04c7fe6d75857190b7001148164f08cf5f4

e: I’ve rebuilt docker hub images to use PHP8. Enjoy. :smiling_imp:

in case this isn’t obvious - UPDATE ALL UNBUNDLED PLUGINS.

Just for reference… with Updater-Logs showing:

[10:08:56/10] Spawned child process with PID 24 for task 0.
sh: /usr/bin/php: not found
[10:08:56/10] Spawned child process with PID 26 for task 1.
sh: /usr/bin/php: not found

deleting config.php (and letting it regenerate during next startup) solved the problem.

updated to latest php8 docker, i get these warning and feeds stopped updating

web:

?08/Feb/2021:14:58:02 +0000 [ERROR 0 /tt-rss/backend.php] PHP message: PHP Warning: Array to string conversion in /var/www/html/tt-rss/include/errorhandler.php on line 24PHP message:

updater:

PHP Warning:  Array to string conversion in /var/www/html/tt-rss/include/errorhandler.php on line 24
PHP Warning:  Undefined array key "uid" in /var/www/html/tt-rss/classes/logger/sql.php on line 13
[15:02:56/13] Received SIGCHLD, 0 active tasks left.
[15:03:50/13] 0 active tasks, next spawn at 60 sec.

app:

[14:44:15/1723] Database schema is already at latest version.
PHP Warning:  Undefined variable $_SESSION in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Undefined variable $_SESSION in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/tt-rss/classes/logger/sql.php on line 13

you’ve posted warnings about error reporting and no actual error that caused it. if feeds don’t update you need to check updater log. see posts above.

now i see this updater log :frowning:

id: unknown user app,
192.168.xx.xx:5432 - accepting connections,
[15:21:32/13] Spawn interval: 120 sec,
[15:21:32/13] Installing shutdown handlers,
[15:21:32/13] Spawned child process with PID 15 for task 0.,
[15:21:32/13] Spawned child process with PID 17 for task 1.,
sh: /usr/bin/php: not found,
sh: /usr/bin/php: not found,
[15:21:33/13] Child process with PID 15 seems active but lockfile is unlocked.,
[15:21:33/13] Child process with PID 17 reaped.,
[15:21:33/13] Received SIGCHLD, 0 active tasks left.,
[15:21:33/13] Received SIGCHLD, 0 active tasks left.,

given that PHP interpreter change broke old config.php for everyone, we might as well just overwrite it.

https://git.tt-rss.org/fox/ttrss-docker-compose/commit/75d1291976b9d4fd5b38a43dafdb4c78f7771ed0

same for docker hub image.

now it says Incorrect username or password, cant login

app log:

[15:54:31/1725] Lock: update.lock
[15:54:31/1725] Checking for updates (pgsql)...
[15:54:31/1725] Database schema is already at latest version.
PHP Warning:  Undefined variable $_SESSION in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Undefined variable $_SESSION in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/tt-rss/classes/logger/sql.php on line 13

PHP Warning: Undefined variable $_SESSION in /var/www/html/tt-rss/classes/logger/sql.php on line 13

this line should read

$owner_uid = $_SESSION["uid"] ?? null;

if its anything else then you’ve managed to screw things up.

e: you’re not using docker hub images, right?

no am not using docker hub.

 * branch            master     -> FETCH_HEAD
Already up to date.
NOTICE:  extension "pg_trgm" already exists, skipping
 schema_version 
----------------
            140
(1 row)

PHP Warning:  Undefined array key 8 in /var/www/html/tt-rss/classes/pluginhost.php on line 143
PHP Warning:  Undefined array key 50 in /var/www/html/tt-rss/classes/pluginhost.php on line 147
PHP Warning:  Undefined array key 1 in /var/www/html/tt-rss/classes/pluginhost.php on line 143
PHP Warning:  Undefined array key 50 in /var/www/html/tt-rss/classes/pluginhost.php on line 147
PHP Warning:  Undefined array key 37 in /var/www/html/tt-rss/classes/pluginhost.php on line 143
PHP Warning:  Undefined array key 50 in /var/www/html/tt-rss/classes/pluginhost.php on line 147
[15:54:31/1725] Lock: update.lock
[15:54:31/1725] Checking for updates (pgsql)...
[15:54:31/1725] Database schema is already at latest version.
PHP Warning:  Undefined variable $_SESSION in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Undefined variable $_SESSION in /var/www/html/tt-rss/classes/logger/sql.php on line 13
PHP Warning:  Trying to access array offset on value of type null in /var/www/html/tt-rss/classes/logger/sql.php on line 13
[08-Feb-2021 15:54:31] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[08-Feb-2021 15:54:31] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root

you’re using old source code with php8. why? who knows. good luck.

on docker console, its getting php8 branch

stopped containers
From https://git.tt-rss.org/fox/ttrss-docker-compose
 * branch            dynamic-php8 -> FETCH_HEAD
Already up to date.
Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/

but in app container log i see this, which i posted earlier

updating tt-rss source in /var/www/html/tt-rss from https://git.tt-rss.org/fox/tt-rss.git...
From https://git.tt-rss.org/fox/tt-rss
 * branch                master     -> FETCH_HEAD
Updating 983a874dd..20b56b5b2

this has been already merged into master.

I am seeing PHP warnings. (shown under preferences → system, indicated by a yellow triangle with an exclamation mark on the homepage)

Fehler 	Dateiname 	Meldung 	Benutzer 	Datum
E_WARNING (2)	lib/jimIcon.php:107	imagecreatefromstring(): Data is not in a recognized format	19:47
E_WARNING (2)	lib/jimIcon.php:107	imagecreatefromstring(): Data is not in a recognized format 19:29

Am I the only one? What could be the problem?

yeah i’m afraid GD is “special” in that it absolutely ignores all error controls in php and just shits out its useless warning which is impossible to hide. i’m honestly not sure what to do about it.

e: the warning is generated when favicon image can’t be loaded so it’s nothing to worry about.

e2: https://git.tt-rss.org/fox/tt-rss/commit/6c8ccd2acca72f4fe0c2cd0c27329150bbf96a30

worst hack of the year so far

I’m seeing a lot of these warnings since the upgrade:

Undefined array key “feed_title”

  1. classes/api.php(774): ttrss_error_handler(2, Undefined array key “feed_title”, classes/api.php, 774)
  2. classes/api.php(223): api_get_headlines(76, 15, 0, , , 1, 1, adaptive, updated, 1, 0, , 1, 1, , 256, 0, 1)
  3. api/index.php(79): getHeadlines()

Remote IP: *******
Request URI: /tt-rss/api/
User agent: Tiny Tiny RSS (Android) 1.296 (530) Dalvik/2.1.0 (Linux; U; Android 11; Pixel 5 Build/RQ1A.210105.003)

The offending line is:

$headline_row["feed_title"] = $line["feed_title"] ? $line["feed_title"] :
  $feed_title;

Apparently accessing an undefined array key was upgraded from a notice to a warning in php 8, so I guess the test should be changed to use isset.