• Resolved suziq407

    (@suziq407)


    Hello,

    in my WP installation I have disabled WP_CRON. Instead I have set up the following command with my provider:
    php -f ~/html/<SERVER>/htdocs/wp-cron.php

    So every 5 minutes I receive emails with the following error:
    PHP Parse error: syntax error, unexpected ‘?’ in /data/web/xxxxxx/html/<SERVER>/htdocs/wp-content/plugins/cf7-conditional-fields/wpcf7cf-options.php on line 291

    I looked at line 291 in the wpcf7cf-options.php file, but I don’t know about PHP.

    This is the corresponding section of this file:

    289 add_action( ‘wp_ajax_wpcf7cf_dismiss_notice’, ‘wpcf7cf_dismiss_notice’ );
    290 function wpcf7cf_dismiss_notice() {
    291 $notice_id = sanitize_text_field($_POST[‘noticeId’] ?? ”);
    292 $notice_suffix = $notice_id ? ‘_’.$notice_id : $notice_id;
    293
    294 $settings = wpcf7cf_get_settings();
    295 $settings[‘notice_dismissed’.$notice_suffix] = true;
    296 wpcf7cf_set_options($settings);
    297 }

    The parse error only occurs with Conditional Fields for Contact Form 7 (my version 2.1). If I disable the plugin there is no parse error at all.

    Can anyone help me with this?

    • This topic was modified 2 years, 9 months ago by suziq407.
    • This topic was modified 2 years, 9 months ago by suziq407.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    which PHP version are you on? You should be able to look this up in your hosting panel. The plugin requires you to be at least on PHP 7.0

    Thread Starter suziq407

    (@suziq407)

    My PHP version is 7.4.26.
    Sorry, I could have thought of that too ??

    Plugin Author Jules Colle

    (@jules-colle)

    Are you sure, because the error indicates that the null coalescing operator isn’t recognized. However, this operator was added in PHP 7.0 so it shouldn’t trigger this specific error. Could you point your hosting support to this thread, and ask for their opinion on this?

    Thread Starter suziq407

    (@suziq407)

    https://www.akademie-bge.at/phpinf.php — without “o” ??

    The provider will certainly not participate here … ??

    Thread Starter suziq407

    (@suziq407)

    Ok, this workaround now works for me:

    function wpcf7cf_dismiss_notice() {

    // WORKAROUND
    $temp = sanitize_text_field($_POST[‘noticeId’]);
    $notice_id = isset($temp) ? $temp : ”;
    // END WORKAROUND

    // $notice_id = sanitize_text_field($_POST[‘noticeId’] ?? ”);
    $notice_suffix = $notice_id ? ‘_’.$notice_id : $notice_id;

    $settings = wpcf7cf_get_settings();
    $settings[‘notice_dismissed’.$notice_suffix] = true;
    wpcf7cf_set_options($settings);
    }

    The problem is that the cron service at the provider cannot do its job because PHP stops parsing. Therefore, updates are not made automatically and also no backups and other tasks.

    However, it would be very interesting to find out about this error.
    Is it possible that a special PHP module is not loaded here by my provider?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Parse error in wpcf7cf-options.php on line 291’ is closed to new replies.