PHP 8.1+ compatibility for NFW with WP multisite
-
When running NFW in Full WAF mode with a multisite instance of WordPress, the existing code for querying the options table no longer works with PHP 8.1+, as querying a non-existent table yields an exception in PHP 8.1+.
Please consider replacing the nested conditionals with try/catch to ensure that the exception is handled:
lib/firewall.php
try { $nfw_['result'] = @$nfw_['mysqli']->query('SELECT * FROM' . $nfw_['mysqli']->real_escape_string($nfw_['table_prefix']) . "optionsWHEREoption_name= 'nfw_options'"); } catch (Exception $e){ // Maybe this is an old multisite install where the main site // options table is named 'wp_1_options' instead of 'wp_options' try { $nfw_['result'] = @$nfw_['mysqli']->query('SELECT * FROM' . $nfw_['mysqli']->real_escape_string($nfw_['table_prefix']) . "1_optionsWHEREoption_name= 'nfw_options'"); // Change the table prefix to match 'wp_1_options' $nfw_['table_prefix'] = "{$nfw_['table_prefix']}1_"; } catch (Exception $e){ return 5; } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
You must be logged in to reply to this topic.