I am trying to patch an issue with WP Plugin Contact Form 7 running on Google App Engine.
The patch code is:
Now when I test the contact form I get a 500 error in browser and checking the App Engine request logs, shows this error:
<strong>PHP Fatal error:</strong>
<blockquote>
Cannot unset string offsets in /base/data/home/apps/s~aura-www/20170807t210800.403218500896707567/wordpress/wp-content/plugins/cf7_fix_plugin.php on line 8
</blockquote>
Is there a problem with the PHP code?
The patch code is:
Code:
<?php
/*
Plugin Name: Fix Contact Form 7
*/
add_filter('wp_mail', 'fix_wp_mail_filter', 11);
function fix_wp_mail_filter($args) {
unset($args['headers']['X-WPCF7-Content-Type']);
$new_wp_mail = array(
'to' => $args['to'],
'subject' => $args['subject'],
'message' => $args['message'],
'headers' => $args['headers'],
'attachments' => $args['attachments'],
);
return $new_wp_mail;
}
Now when I test the contact form I get a 500 error in browser and checking the App Engine request logs, shows this error:
<strong>PHP Fatal error:</strong>
<blockquote>
Cannot unset string offsets in /base/data/home/apps/s~aura-www/20170807t210800.403218500896707567/wordpress/wp-content/plugins/cf7_fix_plugin.php on line 8
</blockquote>
Is there a problem with the PHP code?