Support » Plugin: Gravity Forms Constant Contact » PHP 7 Compatibility

  • Resolved Justin McGuire

    (@vijustin)


    This plugin has a couple of PHP 7 issues, do you have a timeline for making your plugin PHP 7 compatible?

    FILE: /nas/content/live/meekerdevcorp/wp-content/plugins/gravity-forms-constant-contact/api/cc_class.php
    ————————————————————————————————————-
    FOUND 2 ERRORS AFFECTING 1 LINE
    ————————————————————————————————————-
    82 | ERROR | Extension ‘ereg’ is deprecated since PHP 5.3 and removed since PHP 7.0 – use pcre instead.
    82 | ERROR | Function eregi() is deprecated since PHP 5.3 and removed since PHP 7.0; use preg_match instead
    ————————————————————————————————————-

    FILE: /nas/content/live/meekerdevcorp/wp-content/plugins/gravity-forms-constant-contact/constantcontact.php
    ———————————————————————————————————–
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ———————————————————————————————————–
    1295 | WARNING | Use of deprecated PHP4 style class constructor is not supported since PHP 7.
    ———————————————————————————————————–

Viewing 9 replies - 1 through 9 (of 9 total)
  • I may be wrong, but I am testing this (line 81-83 – /wp-content/plugins/gravity-forms-constant-contact/api/cc_class.php) :

            protected function isValidEmail($email){
                 return preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email);
            }

    Just wanted to follow up on the question of PHP7 compatibility…? Thanks!

    greghollowell

    (@greghollowell)

    Hi there,
    Same question, same errors and warning as vijuston found using the WP Engine PHP Compatibility Checker. I’d love to keep using your plugin if possible.
    Thank you.

    greghollowell

    (@greghollowell)

    In the meantime…
    To make this version PHP7 Compatible, change line 82 of plugins/gravity-forms-constant-contact/api/cc_class.php from:
    return eregi(“^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$”, $email);
    to:
    return preg_match(“^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$”, $email);

    bcwd

    (@bcwd)

    you missed the /i switch, so your example is case sensitive greg.

    eregi is preg match with /i – though it seems like regex would be a more modern way.

    From what I can tell, the function that contains the offending code – isValidEmail – is never actually used anywhere within the plugin.

    Plugin Author Zack Katz

    (@katzwebdesign)

    Yes, isValidEmail isn’t used in the code. Version 3.0 should be PHP 7+ compatible.

    FILE: /nas/content/live/meekerdevcorp/wp-content/plugins/gravity-forms-constant-contact/api/cc_class.php
    ————————————————————————————————————-
    FOUND 2 ERRORS AFFECTING 1 LINE
    ————————————————————————————————————-
    82 | ERROR | Extension ‘ereg’ is deprecated since PHP 5.3 and removed since PHP 7.0 – use pcre instead.
    82 | ERROR | Function eregi() is deprecated since PHP 5.3 and removed since PHP 7.0; use preg_match instead

    is still an issue in 3.0

    Oh, if the function isn’t used, it’s a false-positive. OK!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘PHP 7 Compatibility’ is closed to new replies.