Warning: Trying to access array offset on value of type null
-
Hello
Recently did a fresh installation of the Nelio AB testing plugin (version 8.2.2), and as soon as the plugin was activated received the following warning:
Trying to access array offset on value of type nullThe backtrace is the following
wp-content/plugins/nelio-ab-testing/includes/utils/functions/cookie-testing.php:29
{closure}()
wp-content/plugins/nelio-ab-testing/includes/utils/functions/cookie-testing.php:44
nab_get_variant_loading_strategy()
wp-content/plugins/nelio-ab-testing/includes/hooks/cookie-testing.php:66
Nelio_AB_Testing\H\C\disable_incompatible_plugin_settings()
wp-includes/class-wp-hook.php:341
do_action('plugins_loaded')
wp-settings.php:593From a very brief look at the code, seems like
$setting = $settings->get( 'alternative_loading' );is returning a null value, thus causing the warning on the next line where$settings['mode']is accessed.Unsure what’s the root cause of that, but a quick patch could be the following:
$setting = $settings->get( 'alternative_loading' );
$mode = isset($setting['mode']) ? $setting['mode'] : 'redirection';This ensures that if a value is not set, then the default “redirection” mode will be used.
Happy to provide more information if needed.
You must be logged in to reply to this topic.