• Using php8.1 along with the Constant Contact integration that comes with CF7.

    I am getting the below error when attempting to submit a form where I have a select in use so users can select their state instead of typing it in. I have copied/pasted that input below. When the data is posted to the server, the your-address-state is posted as a string. When CF7 is processing the data to create the $submission->posted_data in at about /includes/submission.php:319 that string is converted into an array with $value = (array) $value;. Later on down the line the Constant Contact module calls the add_street_address function where the error occurs.

    In the interim, I will probably just allow users to type in their state or rollback to a previous version of php.

    [select* your-address-state include_blank "Alabama""Alaska""Arizona""Arkansas""California""Colorado""Connecticut""Delaware""Florida""Georgia""Hawaii""Idaho""Illinois""Indiana""Iowa""Kansas""Kentucky""Louisiana""Maine""Maryland""Massachusetts""Michigan""Minnesota""Mississippi""Missouri""Montana""Nebraska""Nevada""New Hampshire""New Jersey""New Mexico""New York""North Carolina""North Dakota""Ohio""Oklahoma""Oregon""Pennsylvania""Rhode Island""South Carolina""South Dakota""Tennessee""Texas""Utah""Vermont""Virginia""Washington""Washington D.C.""West Virginia""Wisconsin""Wyoming"]

    [26-Apr-2022 21:56:52 UTC] PHP Fatal error:  Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /home/site/public_html/wp-content/plugins/contact-form-7/modules/constant-contact/contact-post-request.php:282
    Stack trace:
    #0 /home/site/public_html/wp-content/plugins/contact-form-7/modules/constant-contact/contact-post-request.php(282): trim(Array)
    #1 /home/site/public_html/wp-content/plugins/contact-form-7/modules/constant-contact/contact-post-request.php(86): WPCF7_ConstantContact_ContactPostRequest->add_street_address('', '', Array, '', '')
    #2 /home/site/public_html/wp-content/plugins/contact-form-7/modules/constant-contact/constant-contact.php(95): WPCF7_ConstantContact_ContactPostRequest->build(Object(WPCF7_Submission))
    #3 /home/site/public_html/wp-includes/class-wp-hook.php(303): wpcf7_constant_contact_submit(Object(WPCF7_ContactForm), Array)#4 /home/site/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
    #5 /home/site/public_html/wp-includes/plugin.php(470): WP_Hook->do_action(Array)#6 /home/site/public_html/wp-content/plugins/contact-form-7/includes/contact-form.php(1055): do_action('wpcf7_submit', Object(WPCF7_ContactForm), Array)
    #7 /home/site/public_html/wp-content/plugins/contact-form-7/includes/rest-api.php(336): WPCF7_ContactForm->submit()
    #8 /home/site/public_html/wp-includes/rest-api/class-wp-rest-server.php(1140): WPCF7_REST_Controller->create_feedback(Object(WP_REST_Request))
    #9 /home/site/public_html/wp-includes/rest-api/class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/contact-form-7...',Array, NULL)
    #10 /home/site/public_html/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch(Object(WP_REST_Request))
    #11 /home/site/public_html/wp-includes/rest-api.php(370): WP_REST_Server->serve_request('/contact-form-7...')
    #12 /home/site/public_html/wp-includes/class-wp-hook.php(303): rest_api_loaded(Object(WP))
    #13 /home/site/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
    #14 /home/site/public_html/wp-includes/plugin.php(518): WP_Hook->do_action(Array)
    #15 /home/site/public_html/wp-includes/class-wp.php(388): do_action_ref_array('parse_request', Array)
    #16 /home/site/public_html/wp-includes/class-wp.php(750): WP->parse_request('')
    #17 /home/site/public_html/wp-includes/functions.php(1291): WP->main('')
    #18 /home/site/public_html/wp-blog-header.php(16): wp()
    #19 /home/site/public_html/index.php(17): require('/home/site...')
    #20 {main}
      thrown in /home/site/public_html/wp-content/plugins/contact-form-7/modules/constant-contact/contact-post-request.php on line 282
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter alexwbaumann

    (@alexwbaumann)

    I already rolled the other site back to php7.4 to keep it working. But I have setup https://cf7test.w101.betadp.com/ using the theme Twenty Twenty-Two and the only plugin installed is Contact Form 7. Once setting up a new application in Constant Contact and adding the API details to CF7, the same error ends up in the error log.

    When submitting a test, the ajax call will return a 500 status code along with the “There has been a critical error on this website.” error that WordPress displays.

    Thread Starter alexwbaumann

    (@alexwbaumann)

    @takayukister I wanted to ensure that you saw my last response with a link to a site where this can be tested. Let me know if you have any other questions or if I can help any way with the error.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    I have confirmed the problem and will fix it in the next release. Sorry for my late reply.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP Fatal error: Uncaught TypeError: trim()’ is closed to new replies.