PHP 8 support in CiviCRM extensions

Közzétéve
2023-01-04 11:17
Written by
bgm

Now that PHP 7.4 is "end of life", system administrators are strongly encouraged to adopt PHP 8.0. CiviCRM has supported PHP 8.0 for some time now, but adoption so far has been slow. Here are the stats as of today:

Source: stats.civicrm.org

One notable setback, is PHP 8 support by extensions. A common problem affecting extensions was a line of code generated by a developer tool ("civix") which was considered valid in the past, but not anymore. The tool has long been fixed, but it requires all extension developers to update their extensions.

The good news is that there has been a lot of progress lately. Most of the actively maintained extensions support PHP 8.0.

I ran a quick scan to detect extensions that are not yet ready. Of the 140 extensions that are "reviewed" and can be installed directly from the CiviCRM interface, 30 of those extensions do not support PHP 8.0.

Please note: if you open a bug report against one of these extensions, please be kind to the maintainers! Many of them have contributed these extensions as part of their work, in the hope that it helps others, but it does not mean that they can provide free support. However, if the maintainer does not respond after a few weeks, we will disable the "reviewed" status of the extension, so that administrators do not accidentally install an extension that does not work with PHP 8.

If the extension is not listed below, then in theory it should work on PHP 8. Extensions that have a checkmark ✔ have been fixed since this blog post was initially published.

Extensions with the mention "fixed in dev" means that the latest development version has fixed the issue, but the maintainer has not yet published an official release.

There are many more extensions in the directory - around 400 extensions - those that have not been reviewed. Since a fair amount of extensions are abandoned, the list below only shows those that are reportedly used by over 20 CiviCRM sites:

In the vast majority of the extensions, the PHP compatibility issues were because of that infamous line in "civix". In some rare cases, it was caused by third-party libraries shipped by the extension.

To fix the civix bug, update civix, then run "civix upgrade" on the command line. Don't forget to tag a release! If you are in a rush and looking for a quickfix, edit the "civix" file (example.civix.php) and look for "$entry{0}", replace it with "$entry[0]".

If you have fixed an extension, please leave a comment here, or message me on the chat (on the "extensions" channel), so that I update the above lists.

A huge thanks to everyone who has pushed forward the issue of PHP compatibility! I will go and fix my extensions now ;-)

Filed under

Comments

We are currently working on a PHP 8.0 compatible update for de.systopia.birthdays
It will probably come with email birthday notifications if enabled :)

@jofranz Thank you! Let me know when it's done. Considering the high number of users, I can do a very quick review of the extension.

This problem also affects some Drupal 7 modules as well

Thank you Björn! I have updated the blog post.

I don't know if this is an extension problem but when I tried php8 the send for events registration malfunctioned. It would not send to the cc or bcc people listed.

@the_artifactory Did it work before on PHP 7.4? It seems unlikely, but I'll keep an eye and will try to test.

Quick update: the list of extensions in the blog post has been updated to reflect those that have been fixed since this was initially written. We have also started removing the "reviewed" status of extensions that have not yet been fixed (and will add it back once it's fixed).

If you need help maintaining your extension, please ping me on the mattermost chat (@bgm on https://chat.civicrm.org/civicrm/channels/extensions/)

We had to disable angular profiles 4.7.31-1.1.1 to get civicrm 5.61.4 to run under php 8.0