• After upgrading to v6, WPCF7 threw this errorexception today:

    ErrorException: Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
    #0 /wp-content/plugins/contact-form-7/includes/formatting.php(648): wpcf7_strip_whitespaces
    #1 /wp-content/plugins/contact-form-7/includes/formatting.php(625): {closure}
    #2 [internal](0): array_map
    #3 /wp-content/plugins/contact-form-7/includes/formatting.php(627): wpcf7_strip_whitespaces
    #4 /wp-content/plugins/contact-form-7/includes/swv/php/rules/required.php(24): Contactable\SWV\RequiredRule::validate
    #5 /wp-content/plugins/contact-form-7/includes/swv/swv.php(167): WPCF7_SWV_Schema::validate
    #6 /wp-content/plugins/contact-form-7/includes/swv/schema-holder.php(34): WPCF7_ContactForm::validate_schema
    #7 /wp-content/plugins/contact-form-7/includes/submission.php(566): WPCF7_Submission::validate
    #8 /wp-content/plugins/contact-form-7/includes/submission.php(90): WPCF7_Submission::{closure}
    #9 [internal](0): call_user_func
    #10 /wp-content/plugins/contact-form-7/includes/l10n.php(147): wpcf7_switch_locale
    #11 /wp-content/plugins/contact-form-7/includes/submission.php(137): WPCF7_Submission::proceed
    #12 /wp-content/plugins/contact-form-7/includes/submission.php(35): WPCF7_Submission::get_instance
    #13 /wp-content/plugins/contact-form-7/includes/contact-form.php(1076): WPCF7_ContactForm::submit
    #14 /wp-content/plugins/contact-form-7/includes/rest-api.php(369): WPCF7_REST_Controller::create_feedback
    #15 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(1292): WP_REST_Server::respond_to_request
    #16 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server::dispatch
    #17 /wordpress/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server::serve_request
    #18 /wordpress/wp-includes/rest-api.php(459): rest_api_loaded
    #19 /wordpress/wp-includes/class-wp-hook.php(324): WP_Hook::apply_filters
    #20 /wordpress/wp-includes/class-wp-hook.php(348): WP_Hook::do_action
    #21 /wordpress/wp-includes/plugin.php(565): do_action_ref_array
    #22 /wordpress/wp-includes/class-wp.php(418): WP::parse_request
    #23 /wordpress/wp-includes/class-wp.php(818): WP::main
    #24 /wordpress/wp-includes/functions.php(1342): wp
    #25 /wordpress/wp-blog-header.php(16): require
    #26 /index.php(23)

    I’m not sure what the contact form body was that caused it, but it did generate an exception which you should probably fix. $input is null on that line.

    Thank you.

    • This topic was modified 8 months, 3 weeks ago by archon810.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter archon810

    (@archon810)

    I pasted the url, but it’s held in moderation right now.

    I think the key is figuring out what in a message could lead to this exception, but the message was lost due to the crash.

    Moderator Support Moderator

    (@moderator)

    @archon810: I put the URL in the URL field in the first post. Otherwise, the “apk” keeps triggering the anti-spam protection.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thank you, @moderator

    @archon810 What other plugins and theme do you use on the site?

    Thread Starter archon810

    (@archon810)

    @takayukister I’m sorry, I can’t share the list and we also have a lot of inhouse code in plugins, but I’m not sure any of it would affect the contact forms. I think it’s really about the contact form data that specific user submitted.

    I just checked Sentry and there have been 2 more instances of this. Luckily, it seems that Sentry saved the form data after all in the report leading up to the crash. The bad news is I think it mangled some characters that caused the notice because a few of them are showing up as incorrect characters, and pasting the form content from Sentry doesn’t result in a form crash.

    I’m not sure what the characters are, but here’s a screenshot of one such submission:

    Here’s another:

    It looks like spam, plus it’s in Arabic, but that’s not really the point – crashes should not happen in the form.

    • This reply was modified 8 months, 2 weeks ago by archon810.
    • This reply was modified 8 months, 2 weeks ago by archon810.
    Thread Starter archon810

    (@archon810)

    Any updates please?

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    studiobrabo

    (@studiobrabo)

    This is happening because the $input for the function wpcf7_strip_whitespaces is null. Maybe you can check that input is not null before the preg_replace runs?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘ErrorException: Deprecated: preg_replace(): Passing null to parameter #3’ is closed to new replies.