The issue was with the $cf7_version = get_option(‘wpcf7’, ‘1.0.0’); in the file wp-content/plugins/wp-math-captcha/includes/integration-cf7.php
To solve the issue add “$cf7_version = $cf7_version[‘version’];” below ” $cf7_version = get_option(‘wpcf7’, ‘1.0.0’);”
or add the following code in your functions.php
add_filter('wpcf7_validate_mathcaptcha', 'my_mathcaptcha_validation_filter', 10, 2);
function my_mathcaptcha_validation_filter($result, $tag)
{
$tag = new WPCF7_Shortcode($tag);
$name = $tag->name;
if(!is_admin() && isset($_POST[$name]))
{
$cf7_version = get_option('wpcf7', '1.0.0');
$cf7_version = $cf7_version['version'];
if($_POST[$name] !== '')
{
$session_id = (isset($_POST[$name.'-sn']) && $_POST[$name.'-sn'] !== '' ? Math_Captcha()->cookie_session->session_ids['multi'][$_POST[$name.'-sn']] : '');
if($session_id !== '' && get_transient('cf7_'.$session_id) !== false)
{
if(strcmp(get_transient('cf7_'.$session_id), sha1(AUTH_KEY.$_POST[$name].$session_id, false)) !== 0)
{
if(version_compare($cf7_version, '4.1.0', '>='))
$result['reason'][$name] = wpcf7_get_message('wrong_mathcaptcha');
else
{
$result['valid'] = false;
$result->invalidate($tag, wpcf7_get_message('wrong_mathcaptcha'));
}
}
}
else
{
if(version_compare($cf7_version, '4.1.0', '>='))
$result->invalidate($tag, wpcf7_get_message('time_mathcaptcha'));
else
{
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message('time_mathcaptcha');
}
}
}
else
{
if(version_compare($cf7_version, '4.1.0', '>='))
$result->invalidate($tag, wpcf7_get_message('fill_mathcaptcha'));
else
{
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message('fill_mathcaptcha');
$result->invalidate($tag, wpcf7_get_message('fill_mathcaptcha'));
}
}
}
return $result;
}