Skip to content

Upgrade path to PHP 8

onli edited this page Sep 28, 2023 · 7 revisions

Please follow this guide if you want to run Serendipity with PHP 8.

Context

Serendipity was incompatible with PHP 8 until Version 2.4-beta1, by now released in stable form as 2.4.0. Earlier versions will report many compatibility warnings and some fatal errors. This was made worse by the then-current version of the used template engine Smarty being partly incompatible with PHP 8.

2.4-beta1 fixed all those warnings in the core code and core theme templates, and changed the prior buggy error reporting so that non-fatal errors in themes and plugins no longer stop the code execution. In parallel, all additional themes and many plugins were fixed to be compatible with PHP 8.0 when run with 2.4-beta1.

PHP 8.2 is again not fully compatible with 2.4. 2.5-beta1 or later is the version to use if you run PHP 8.2 or PHP 8.1 (but you should directly jump to PHP 8.2). 2.5-beta1 is also still compatible with PHP 7.4, so you can follow the upgrade hints below and jump from Serendipity 2.3.5 with PHP 7.4 to Serendipity 2.5-beta1 with PHP 8.2.

Upgrade Preparation

It is assumed that you currently run Serendipity 2.3.5 with PHP 7.3 or 7.4. If that's not the case, minimize issues with an upgrade to these serendipity and PHP versions first.

Also, make a backup. We all know that Serendipity upgrades in the past almost always worked without any issues. But this time the changes are significant and PHP 8 by itself introduces a new potential for errors.

Now, upgrade all your plugins. Old plugin version will definitely cause issues with PHP 8. You should also uninstall old custom plugins, if you have any, and upgrade them to be compatible with PHP 8 in a development setup (your old PHP code will almost definitely not be compatible!).

If you run a forked theme, consider switching back to 2k11 for a while. Themes bundled with the core (like 2k11) will be overwritten with the necessary fixes. But forked themes or themes from Spartacus will not be overwritten automatically. This can lead to errors later. By using 2k11 you can workaround this problem.

You are ready to upgrade Serendipity to 2.4.0.

Your blog should now work fine with Serendipity 2.4.0 on PHP 7.

If you have used it so far, disable the comments sidebar plugin (serendipity_plugin_comments). A bug with it slipped into the release of 2.4.0 and will trigger on PHP 8 (this was fixed with 2.5-beta1).

Finally, you can set your server to PHP 8. Your Serendipity blog should continue to work.