The hf_validate_form filter throws errors since v1.5.0
-
Thanks for this great plugin!
I have built a simple Turnstile integration for it. I validate the Turnstile response using the
hf_validate_form
filter. Which worked fine until version 1.5.0. Since then, whenever there is a validation error, and I return a non-empty string from the filter, I get the following error message:[07-Feb-2025 20:03:24 UTC] PHP Warning: Undefined variable $submission in /path/to/my/site/wp-content/plugins/html-forms/src/class-forms.php on line 333
[07-Feb-2025 20:03:24 UTC] PHP Fatal error: Uncaught TypeError: HTML_Forms\Forms::get_response_for_error_code(): Argument #3 ($submission) must be of type HTML_Forms\Submission, null given, called in /path/to/my/site/wp-content/plugins/html-forms/src/class-forms.php on line 334 and defined in /path/to/my/site/wp-content/plugins/html-forms/src/class-forms.php:380
Stack trace:
#0 /path/to/my/site/wp-content/plugins/html-forms/src/class-forms.php(334): HTML_Forms\Forms->get_response_for_error_code('turnstile_error', Object(HTML_Forms\Form), NULL, Array)
#1 /path/to/my/site/wp-includes/class-wp-hook.php(324): HTML_Forms\Forms->HTML_Forms\{closure}('')
#2 /path/to/my/site/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /path/to/my/site/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /path/to/my/site/wp-settings.php(726): do_action('wp_loaded')
#5 /path/to/my/site/wp-config.php(116): require_once('/Users/wiegerts...')
#6 /path/to/my/site/wp-load.php(50): require_once('/Users/wiegerts...')
#7 /path/to/my/site/wp-admin/admin-ajax.php(22): require_once('/Users/wiegerts...')
#8 /Applications/Herd.app/Contents/Resources/valet/server.php(167): require('/Users/wiegerts...')
#9 {main}
thrown in /path/to/my/site/wp-content/plugins/html-forms/src/class-forms.php on line 380It seems a change was made in version 1.5.0 which causes this error. It’s probably because the submission object is now passed to the
get_response_for_error_code
method, which was not the case before.Is this something you guys can look into? Thanks in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.