PHP 8 compatibility
-
The current version of Taboola (v1.0.10) is incompatible with PHP 8. The plugin will appear to activate, but Taboola will not appear within the WP Admin menu.
I tracked the problem down to at least two issues that make the plugin incompatible with PHP 8:
– The plugin uses
create_function()
, which was removed from PHP 8: https://www.php.net/manual/en/function.create-function.php
– The plugin uses PHP4 style constructors, which are not allowed in PHP 8I was able to patch the plugin and get it to show up on the WP Admin by making the following modifications:
The following line can be updated to replace
create_function()
with an anonymous function:
https://plugins.trac.www.ads-software.com/browser/taboola/tags/1.0.10/taboola_widget.php#L55– Replace
create_function('', 'return register_widget("WP_Widget_Taboola");')
withfunction() { return register_widget("WP_Widget_Taboola"); }
.PHP4 style constructors are not allowed and
__construct()
should be used instead:
https://plugins.trac.www.ads-software.com/browser/taboola/tags/1.0.10/taboola_widget.php#L31– Replace
function TaboolaWP()
withfunction __construct().
- The topic ‘PHP 8 compatibility’ is closed to new replies.