Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-65479

Review PCRE expressions breaking with PHP 7.3

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.3, 3.7
    • Fix Version/s: 3.6
    • Component/s: General
    • Labels:
    • Testing Instructions:
      Hide
      • Ensure that repository_url_testsuite phpunit passes using PHP 7.3. Can use ci.moodle.org facilities for that.

      (note that there maybe other remaining failures if a full run is performed because there are some problems with both solr/redis and their PHP 7.3 status. At the effects of this issue, they are 100% ignorable).

      Show
      Ensure that repository_url_testsuite phpunit passes using PHP 7.3. Can use ci.moodle.org facilities for that. (note that there maybe other remaining failures if a full run is performed because there are some problems with both solr/redis and their PHP 7.3 status. At the effects of this issue, they are 100% ignorable).
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      PHP 7.3 moves from PCRE1 to PCRE2 engine. That comes with some new features, improvements, 99% backwards compatibility... and with a few incompatibility changes. Mainly:

      • The "S" modifier has not effect anymore. (no impact)
      • The "X" modified is now default on in PCRE2. (no impact)
      • Better handling of unicode. (should be no impact too, haven't found cases out there).
      • Slightly more strict about invalid patters (impact).

      (ref: https://wiki.php.net/rfc/pcre2-migration)

      So, basically this is about to try to find in advance all the PCRE patterns breaking with the new engine and modify them. After having searched the net for docs and cases... the unique case I've been able to find, affecting lots of products... is this, let's call it:

      A) The hyphen case : https://3v4l.org/tliEE
      B) .... (add here if anybody is aware of more cases)

      The approach I'm following to fix this is:

      1. Extract from code base all the candidate expressions matching the case (there will be false positives, no worries).
      2. Run a preg_match() with php71/72 using them:
        1. Those failing will be examined but discarded, 99% of them will be false positives.
        2. Pick those compiling ok and... only with them...
        3. Run the very same preg_match() with php73
          1. Those passing are ok, they are not problematic.
          2. Those failing will be the ones to examine closely. Hopefully not many.

      So, working on it... ciao

      Again: Haven't been able to find other problems apart from A) above. If anybody is aware of any... please share them here.

        Attachments

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Peer reviewer:
            Damyon Wiese
            Integrator:
            Andrew Nicols
            Tester:
            Andrew Nicols
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Dec/18

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 45 minutes
                6h 45m