PHP 8 support?
-
Hi there,
I understand that, for some reason that completely eludes me, Automattic has dropped all support of IntenseDebate (it’s not even listed as a service/app/plugin on Automattic’s own website).
However, even in 2021, it continues to be useful. Dated, sure, but useful.
A few years ago (not many!), PHP 7 came out, and with it, legacy code started to break down. Someone nice at Automattic silently made whatever was required to get IntenseDebate working again. Yay! But now, PHP 8 is knocking at our doors, and it seems that some functionality that was flagged as ‘deprecated’ under PHP 7, now throws a fatal error under PHP 8:
PHP Fatal error: Uncaught Error: Call to undefined function create_function() in <WP_PATH>/wp-content/plugins/intensedebate/intensedebate.php:149 Stack trace: #0 <WP_PATH>/wp-content/plugins/intensedebate/intensedebate.php(2721): id_activate_hooks() #1 <WP_PATH>/wp-settings.php(388): include_once('...') #2 <WP_PATH>/wp-config.php(82): require_once('...') #3 <WP_PATH>/wp-load.php(37): require_once('...') #4 <WP_PATH>/wp-blog-header.php(13): require_once('...') #5 <WP_PATH>/index.php(17): require('...') #6 {main} thrown in <WP_PATH>/wp-content/plugins/intensedebate/intensedebate.php on line 149" while reading response header from upstream
This is a classical example, and one that is very easy to fix — see https://sarah-moyer.com/fix-create_function-deprecated-in-wordpress/ (it also links to other possible solutions), or, even better, https://stackoverflow.com/a/52515758/1035977
On line 149 of
/wp-content/plugins/intensedebate/intensedebate.php
, instead ofadd_filter( 'option_moderation_notify', create_function( '$a', 'return 0;' ) ) add_filter( 'option_comments_notify', create_function( '$a', 'return 0;' ) );
use the following code:
add_filter( 'option_moderation_notify', function($a) { return 0; } ); add_filter( 'option_comments_notify', function($a) { return 0; } );
Basically, create_function() was a hack introduced in PHP 4 (!!!) to allow PHP to have anonymous functions; it became deprecated under 7.2 and was removed in 8.0, since PHP has closures since 5.3.0 and WordPress is supposed to run only under 5.6+ anyway.
create_function()
has serious performance issues and, worse than that, it has some security vulnerabilities, since it relies oneval()
and is theoretically subject to the same issues aseval()
. Eval() is Evil (and that’s from some peer-reviewed academic scientists researching the subject, not random developers with their ‘opinions’!).So please get rid of it! ??
Thanks in advance!
- The topic ‘PHP 8 support?’ is closed to new replies.