Hi Sarah,
I found the cause and a workaround for you.
The warning is from a new security function added in 3.14.10. When you use PHP 8.0+, it triggers an error in the merge tags system.
For now, here is a quick solution. Create a file named nf-fix-neutralize-shortcodes.php and upload it to /wp-content/mu-plugins/ folder. The warnings will stop right away.
<?php
/**
* Plugin Name: Ninja Forms - Fix neutralize_shortcodes warning
* Description: Fix PHP warning "Undefined array key neutralize_shortcodes" in Ninja Forms 3.14.10
* Version: 1.0
* Author: Faisal Ahammad
*/
add_filter('ninja_forms_merge_tags_other', function($tags) {
if (!isset($tags['neutralize_shortcodes'])) {
$tags['neutralize_shortcodes'] = array(
'id' => 'neutralize_shortcodes',
'tag' => '{neutralize_shortcodes}',
'callback' => 'neutralize_shortcodes',
'value' => '',
);
}
return $tags;
});
No activation needed from WordPress admin. Just put the file in the folder and it works.
Let me know if you need help.
Note for Ninja Forms developer team:
The __call method in includes/MergeTags/Other.php line 95 does not check if the key exists before accessing it:
return $this->merge_tags[$name]['value'];
In PHP 8.0+, call_user_func from global scope with protected method callback (like map_deep($value, [$this, 'neutralize_shortcodes'])) triggers __call instead of a fatal error. Since neutralize_shortcodes is not a merge tag key, it throws the warning.
Suggested fix: Add isset() guard:
public function __call($name, $arguments)
{
if (isset($this->merge_tags[$name]['value'])) {
return $this->merge_tags[$name]['value'];
}
return '';
}
Or change neutralize_shortcodes from protected to public. Same issue exists in Calcs.php:21 with calc_value.
Best regards,
Faisal (forum volunteer)