Some field types cause a 500 error when using the webhook feature
-
Using CF7’s built-in acceptance field causes a fatal error to occur when submitting a CF7 form configured to use a webhook. This issue also affects checkboxes, and drop-downs with the
multipleoption.Form example:
<label>Email [email* email]</label>
[acceptance Accept] I consent to being contacted[/acceptance]
[submit "Submit"]Request Body:
{"email":"[email]"}Stacktrace:
NOTICE: PHP message: PHP Fatal error: Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string in /app/public_html/wp-content/plugins/contact-form-7-honeypot/includes/apps/webhook/webhook.php:464
Stack trace:
#0 /app/public_html/wp-content/plugins/contact-form-7-honeypot/includes/apps/webhook/webhook.php(464): str_replace('[Accept]', Array, '{"email":"test@...')
#1 /app/public_html/wp-content/plugins/contact-form-7-honeypot/includes/apps/webhook/webhook.php(432): CF7Apps_Webhook->prepare_webhook_data(5, Array, Array)
#2 /app/public_html/wp-includes/class-wp-hook.php(341): CF7Apps_Webhook->handle_webhook_submission(Object(WPCF7_ContactForm))
#3 /app/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters('', Array)
#4 /app/public_html/wp-includes/plugin.php(522): WP_Hook->do_action(Array)
#5 /app/public_html/wp-content/plugins/contact-form-7/includes/submission.php(127): do_action('wpcf7_mail_sent', Object(WPCF7_ContactForm))
[truncated]The code seems to assume that all form values will be strings, when some of them are actually arrays.
Tested with:
- WordPress 6.9
- PHP 8.2
- Contact Form 7 6.1.4
- CF7 Apps 3.4.0
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.