Using Selfoss with PHP 8

by Triskaideka, Wednesday, December 08, 2021, 17:03 (40 days ago)

Has anybody been using, or tried to use, Selfoss on a web server that runs PHP 8? How has your experience been?

I've been using Selfoss for about a year and it's been fine so far. This weekend I tried to migrate it to a new server with upgraded software, something I've done before without any trouble, but this time I encountered some errors.

The biggest difference between the servers is that the old one had PHP 7.4.3 and the new one has PHP 8.0.13. That's why I suspect that PHP 8 is the culprit. But it's certainly possible that the problem lies elsewhere and the PHP upgrade is a coincidence.

Here's what I see when I visit my Selfoss installation's home page on the PHP 8 server:

Internal Server Error
Undefined array key "ERROR"

Internal Server Error
Unknown named parameter $expire [/path/to/selfoss/vendor/bcosca/fatfree-core/base.php:2284]

Strangely, there's no reference to a variable named "$expire" on line 2284 or anywhere else in fatfree-core/base.php. Here's what line 2284 looks like:


When I check Apache's error logs, there are dozens of lines that look like this:

[Sun Dec 05 17:03:25.833416 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "DEBUG" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1184
[Sun Dec 05 17:03:25.833434 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "CLI" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1239
[Sun Dec 05 17:03:25.833443 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "AJAX" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1239
[Sun Dec 05 17:03:25.833452 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "HIGHLIGHT" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1240
[Sun Dec 05 17:03:25.833462 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "CLI" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1110
[Sun Dec 05 17:03:25.833470 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "PACKAGE" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1112
[Sun Dec 05 17:03:25.833478 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "XFRAME" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1114
[Sun Dec 05 17:03:25.833490 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "VERB" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1118
[Sun Dec 05 17:03:25.833518 2021] [php:warn] [pid 5850] [client] PHP Warning:  Undefined array key "HALT" in /home/kermit/websites/selfoss/vendor/bcosca/fatfree-core/base.php on line 1272

I visited the GitHub page for fatfree-core and noticed that there's a newer version than what ships with Selfoss 2.18. Hoping to get lucky, I downloaded fatfree-core 3.7.3 and replaced Selfoss' version with it. This *may have* resulted in some progress, in the sense that the error messages changed. The web page no longer showed Internal Server Error messages; it was devoid of text but had Selfoss' recognizeable checkered background image. Here are the Apache logs that I saw after that:

[Sun Dec 05 17:20:36.115668 2021] [php:notice] [pid 5855] [client] Undefined property: helpers\\View::$loggedin
[Sun Dec 05 17:20:36.115725 2021] [php:notice] [pid 5855] [client] [templates/home.phtml:145] Base->{closure}()
[Sun Dec 05 17:20:36.115738 2021] [php:notice] [pid 5855] [client] [helpers/View.php:94] include()
[Sun Dec 05 17:20:36.115746 2021] [php:notice] [pid 5855] [client] [controllers/Index.php:35] helpers\\View->render()
[Sun Dec 05 17:20:36.115754 2021] [php:notice] [pid 5855] [client] [index.php:80] Base->run()

I don't really know what to try next, and even if I did, I suspect it'd just lead me deeper down a rabbit hole of error messages. So coming here for help seems like the next step. Has anybody else had success with PHP 8? Anybody seen error messages like these before? Could I have misconfigured something?

Some background on my setup: it's a basic DigitalOcean droplet, so the CPU is shared but I'm in control of what's on the OS. Ubuntu version 20.04.3, Apache version 2.4.41, PHP version 8.0.13. I'm using an SQLite database. I use the droplet for other things, but Selfoss is the arguably the biggest/most complex.

Using Selfoss with PHP 8

by jtojnar, Wednesday, December 08, 2021, 18:55 (40 days ago) @ Triskaideka

As you have noticed selfoss 2.18 does not work with PHP 8. In addition to fatfree, there were many incompatibilities in other libraries and even selfoss itself so I would not recommend trying to fix it piecemeal. You can use nightly builds as those are tested on PHP 8.0 and are quite stable (plus they include tons of other fixes and new features).

Using Selfoss with PHP 8

by Triskaideka, Thursday, December 09, 2021, 04:44 (39 days ago) @ jtojnar

jtojnar, thank you for the advice. I've downloaded the latest nightly build and it seems to be working well so far.

Using Selfoss with PHP 8

by nickrickard, Sunday, January 16, 2022, 16:02 (1 day, 0 hours, 52 min. ago) @ Triskaideka

Having also migrated my server to PHP8, I've downloaded a recent nightly (selfoss-2.19-fdbdb80). Previous selfoss 2.18 on PHP7.4 was working fine.

Now the 'star' and 'mark as read' buttons don't seem to now work. Selfoss is updating feeds (on both a cron job and typing /update into the web bar) so seems to have appropriate permissions for the database. The 'open' and 'share on email' buttons are working.

I've set "logger_level=DEBUG" in config.ini and am not getting anything in the logs when I click 'star' or 'mark as read'. The keyboard shortcuts for these don't work either.

I suspect I've missed something obvious in the docs on the migration from 2.18 to 2.19. Grateful for any pointers as to what it might be, please.

Using Selfoss with PHP 8

by jtojnar, Sunday, January 16, 2022, 22:35 (18 hours, 19 minutes ago) @ nickrickard

I am assuming this is PHP 8.0, since 8.1 is still broken.

No special upgrade procedure should be required so if something does not work, it is a bug.

I was unable to reproduce it.

Could you check if there are any messages in your browser’s developer tools’ console (F12 key), or anything weird in network panel when you press the buttons? Is that desktop or mobile interface? Or did you perhaps enable the offline mode?

Using Selfoss with PHP 8

by nickrickard, Monday, January 17, 2022, 09:11 (7 hours, 43 minutes ago) @ jtojnar

Yes, PHP8.0 (8.0.8-1).

How would I know (or enable/disable) offline mode?

The developer console has a few error messages related to css declarations (things like -moz-box-shadow which I can't see would be relevant to this.) There aren't any script errors or warnings. My adblockers are turned off for my local home site. I'm not sure I'm going to be able to provide much help.

It's the same behaviour on my desktop and mobile, both through Firefox (91ESR desktop, 96 mobile). Clicking on or using keyboard shortcuts for the other buttons work.

If selfoss was trying to write to the database and was denied, would I expect to see something in the logs? I get
"[2022-01-17 07:54:34] selfoss.DEBUG: Established database connection"
when I refresh the page, but nothing that corresponds to a failed click on 'star' or 'mark as read'.

If others aren't seeing this then I don't want to distract your time on something that might be curious or unique to my setup.


Using Selfoss with PHP 8

by Triskaideka, Monday, January 17, 2022, 16:47 (7 minutes ago) @ nickrickard

FWIW, I'm using Selfoss 2.19-8941a31 on PHP 8.0.13 and am not seeing any problems with the "star" or "mark as read" features.

I am seeing other problems, most significantly, that some RSS feeds are not getting updated (with a "connection timed out" message) even though they were fine under Selfoss 2.18 and I can visit them in my browser with no problem. I wasn't sure whether it made sense to submit a bug report for a nightly build, but I can make a fuller post about this here or on GitHub if anyone wants.

RSS Feed of thread
powered by my little forum