• Resolved pauger

    (@pauger)


    The conditional fields module has become incompatible with php version 5.6 due to today’s release of version 1.9.15.
    I know the minimum recommended php version for WordPress is 7.4, but one of my projects is still running on 5.6.
    I have updated manually the wpcf7cf-options.php file. On line 291 there is a ternary operator which is not compatible with old php.
    This is not a request, and it is not absolutely necessary to fix it, I can live with it (I turned off the automatic updates of the module), I just wanted to let you know.

    Otherwise If it is not fixed, please update the plugin page where version 5.6 or higher is described.

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

    (@jules-colle)

    Good call, thanks for letting me know. I think I’ll update the minimum PHP version.
    I discovered some cool PHP 7 features recently, and have gotten used to the ?? operator. It makes coding so much more convenient, so even if I revert that back to if-isset now, I will probably reuse it unintentionally again for a next update.

    Thread Starter pauger

    (@pauger)

    Thanks for the reply.
    Oh, it was not ternary but a null coalescing operator, I wrote wrong.
    I also use it regularly too. πŸ™‚

    • This reply was modified 5 years, 3 months ago by pauger.

    @pauger Hi, I have the same problem as you. Can you send the full manual change you made to line 291. I’m not a developer but just a graphic designer, so not very good at php code! : s thank you

    Thread Starter pauger

    (@pauger)

    Hi @onepresto!

    Just replace the line 291 in the file
    wp-content/plugins/cf7-conditional-fields/wpcf7cf-options.php

    from
    $notice_id = sanitize_text_field($_POST['noticeId'] ?? '');
    to

    $notice_id = (isset($_POST['noticeId'])) ? sanitize_text_field($_POST['noticeId']) : '';
    

    The last function (290-297) shoud be

    function wpcf7cf_dismiss_notice() {
        $notice_id = (isset($_POST['noticeId'])) ? 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);
    }
    
    • This reply was modified 5 years, 3 months ago by pauger.
    • This reply was modified 5 years, 3 months ago by pauger.
    • This reply was modified 5 years, 3 months ago by pauger.
    • This reply was modified 5 years, 3 months ago by pauger.
    • This reply was modified 5 years, 3 months ago by pauger.
    • This reply was modified 5 years, 3 months ago by pauger.
    • This reply was modified 5 years, 3 months ago by pauger.

    @pauger Thanks a lot !!!

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

The topic ‘Incompatible with PHP 5.6’ is closed to new replies.