restezconnectes / send-pdf-for-contact-form-7

Send the PDF for Contact Form 7 plugin will allow you to recover the data yourself via your form to insert them into a PDF built and prepared by you.
https://restezconnectes.fr/tutoriel-wordpress-lextension-send-pdf-for-contact-form-7/
GNU General Public License v3.0
15 stars 17 forks source link

[BUG] v0.9.3 - Error generating PDF #26

Closed AmazingDreams closed 2 years ago

AmazingDreams commented 2 years ago

Since the upgrade to v0.9.2 / v0.9.3, there is an error sending PDF files, which has something to do with conditionally hidden fields. Full stacktrace:

[02-Jul-2022 09:58:47 UTC] PHP Fatal error:  Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /home/REDACTED/public_html/wp-content/plugins/cf7-conditional-fields/Wpcf7cfMailParser.php:34
Stack trace:
#0 /home/REDACTED/public_html/wp-content/plugins/cf7-conditional-fields/Wpcf7cfMailParser.php(34): in_array()
#1 [internal function]: Wpcf7cfMailParser->hide_hidden_mail_fields_regex_callback()
#2 /home/REDACTED/public_html/wp-content/plugins/cf7-conditional-fields/Wpcf7cfMailParser.php(21): preg_replace_callback()
#3 /home/REDACTED/public_html/wp-content/plugins/send-pdf-for-contact-form-7/classes/send-pdf.php(681): Wpcf7cfMailParser->getParsedMail()
#4 /home/REDACTED/public_html/wp-includes/class-wp-hook.php(309): cf7_sendpdf->wpcf7pdf_send_pdf()
#5 /home/REDACTED/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#6 /home/REDACTED/public_html/wp-includes/plugin.php(524): WP_Hook->do_action()
#7 /home/REDACTED/public_html/wp-content/plugins/contact-form-7/includes/submission.php(641): do_action_ref_array()
#8 /home/REDACTED/public_html/wp-content/plugins/contact-form-7/includes/submission.php(86): WPCF7_Submission->before_send_mail()
#9 /home/REDACTED/public_html/wp-content/plugins/contact-form-7/includes/submission.php(27): WPCF7_Submission->proceed()
#10 /home/REDACTED/public_html/wp-content/plugins/contact-form-7/includes/contact-form.php(1046): WPCF7_Submission::get_instance()
#11 /home/REDACTED/public_html/wp-content/plugins/contact-form-7/includes/rest-api.php(357): WPCF7_ContactForm->submit()
#12 /home/REDACTED/public_html/wp-includes/rest-api/class-wp-rest-server.php(1143): WPCF7_REST_Controller->create_feedback()
#13 /home/REDACTED/public_html/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request()
#14 /home/REDACTED/public_html/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch()
#15 /home/REDACTED/public_html/wp-includes/rest-api.php(394): WP_REST_Server->serve_request()
#16 /home/REDACTED/public_html/wp-includes/class-wp-hook.php(307): rest_api_loaded()
#17 /home/REDACTED/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#18 /home/REDACTED/public_html/wp-includes/plugin.php(524): WP_Hook->do_action()
#19 /home/REDACTED/public_html/wp-includes/class-wp.php(398): do_action_ref_array()
#20 /home/REDACTED/public_html/wp-includes/class-wp.php(770): WP->parse_request()
#21 /home/REDACTED/public_html/wp-includes/functions.php(1330): WP->main()
#22 /home/REDACTED/public_html/wp-blog-header.php(16): wp()
#23 /home/REDACTED/public_html/index.php(17): require('/home/REDACTED/...')
#24 {main}
  thrown in /home/REDACTED/public_html/wp-content/plugins/cf7-conditional-fields/Wpcf7cfMailParser.php on line 34

If it is any help, when clearing all content of the PDF, there was no error. However since that is not really an option. I rolled back the plugin to v0.9.1, which has resolved the issue for now.

Please let me know if you need more information.

Thanks for this plugin!

restezconnectes commented 2 years ago

Hi!

I made some tests and i found the bug.

The next version fix it!

Thanks

AmazingDreams commented 2 years ago

Hello. 0.9.4 seems to have resolved the issue, thanks!