• rmmcclay

    (@rmmcclay)


    Just went into WordPress admin, then an alert and the site went into recovery mode. Then tried to Activate Contact Form 7 and got this error:

    Parse error: syntax error, unexpected ‘)’ in?/VirtualHost/somesite.com/wp-content/plugins/contact-form-7/includes/contact-form-functions.php?on line?231

    If I delete and re-install will I lose all our contact forms and settings?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter rmmcclay

    (@rmmcclay)

    This has now happened on another one of our sites:

    https://imgur.com/a/tWRfI3B

    Thread Starter rmmcclay

    (@rmmcclay)

    It has now happened to yet another site, this makes 3 sites affected.

    KZeni

    (@kzeni)

    I’m also seeing this across multiple sites that auto-updated.

    It’s likely a PHP 7.2 compatibility issue where you cannot have a trailing comma at the end of a list of function parameters (it’s fine for an array & things, but that extra comma really isn’t doing anything & actually breaks things for some PHP versions when that same thing is done with a function’s attributes.)

    KZeni

    (@kzeni)

    Also, this isn’t just a matter of not being able to activate the plugin… sites that already had this active that then auto-update find the entire site goes down to a 500 server error that it didn’t catch like it can/does when trying to activate a plugin with a fatal server error (same error details as above.)

    KZeni

    (@kzeni)

    Btw, it seems that editing includes/contact-form-functions.php on line 231 so that:

    if ( ! $contact_form ) {
            return sprintf(
                    '<p class="wpcf7-contact-form-not-found"><strong>%1$s</strong> %2$s</p>',
                    esc_html( __( 'Error:', 'contact-form-7' ) ),
                    esc_html( __( "Contact form not found.", 'contact-form-7' ) ),
            );
    }

    becomes:

    if ( ! $contact_form ) {
            return sprintf(
                    '<p class="wpcf7-contact-form-not-found"><strong>%1$s</strong> %2$s</p>',
                    esc_html( __( 'Error:', 'contact-form-7' ) ),
                    esc_html( __( "Contact form not found.", 'contact-form-7' ) )
            );
    }

    seems to be all that’s needed to avoid the site-wide fatal error (just remove that one comma at the end that’s not doing anything other than potentially breaking some sites with particular PHP versions.)

    KZeni

    (@kzeni)

    As an aside, it might be good for this plugin to update its PHP version requirements for future version releases if testing certain PHP versions is a bit uncertain (given how many sites use this plugin & how many hosting environments might need to be taken into consideration.) For example, having this problematic release require PHP 7.3 or newer would’ve left PHP 7.2 and older as using the last version it knows works well while not updating to a version that may or may not work for them (in this case, it didn’t work.)

    I think it’d make sense to get a hotfix out there as soon as possible with this adjustment so this PHP compatibility issue is resolved for everyone, but introducing a PHP version requirement could be considered for updates after that.

    vplib3

    (@vplib3)

    Hi! I can confirm that I have the same error on my site after updating the plugin to the version 5.7.5.

    https://prnt.sc/CZoY8aJCvBsM

    KZeni

    (@kzeni)

    Ah, looks like version 5.7.5.1 was released a few minutes ago to address this issue. Oh good!

    *I can confirm that updating to 5.7.5.1 on a previously affected site no longer has this issue.

    • This reply was modified 2 years ago by KZeni.
    Thread Starter rmmcclay

    (@rmmcclay)

    Thank you KZeni! Removing the comma solved the problem. I would like to add that I noticed something odd today when I was updating many of our sites. When I went to update Contact Form 7, I saw this very unusual error: Update failed: Download failed. Not Found

    I reloaded the dashboard and tried again and then it showed the “green” Updated. But then soon after, the site locked down. But after removing the comma… all was well.

    vplib3

    (@vplib3)

    @kzeni, thank you! Updating the plugin to 5.7.5.1 helped!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Can’t Activate Contact Form 7’ is closed to new replies.