Support » Plugin: Linkify Text » PHP 7 Compatibility – preg_replace

  • Resolved dylanfitzger

    (@dylanfitzger)


    I receive the following error when trying to validate for PHP 7.

    FILE: ../plugins/linkify-text/linkify-text.php
    ———————————————————————————————————————————-
    FOUND 2 ERRORS AFFECTING 2 LINES
    ———————————————————————————————————————————-
    336 | ERROR | preg_replace() – /e modifier is deprecated since PHP 5.5 and removed since PHP 7.0
    377 | ERROR | preg_replace() – /e modifier is deprecated since PHP 5.5 and removed since PHP 7.0
    ———————————————————————————————————————————-

Viewing 1 replies (of 1 total)
  • Plugin Author Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    Hi @dylanfitzger,

    Thanks for the report! However, I believe the issue being reported is actually a shortcoming of the script or tool doing the validation.

    The plugin file does not use the /e modifier, only /i, /u, /S.

    More than likely the code scanner is looking at this line of code (line 302 of the current v1.8 release):

    $text = preg_replace( "~{$regex}~{$preg_flags}", $new_text, $text, $limit );

    The code scanner is likely seeing the “e” in the variable $preg_flags (which appears in the position a modifier is expected for preg_replace()). But that’s simply a character in a variable.

    What code scanner are you using?

    I have not encountered compatibility warnings or errors while running the plugin under PHP7. (There are some warning that will be fixed in the newest version, but aren’t due to PHP7.)

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.