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

Review PCRE expressions breaking with PHP 7.3



    • 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:


      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.




            • Votes:
              0 Vote for this issue
              5 Start watching this issue


              • Created:
                Fix Release Date:

                Time Tracking

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