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

Review PCRE expressions breaking with PHP 7.3

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.6
    • 3.6.3, 3.7
    • General
    • MOODLE_36_STABLE, MOODLE_37_STABLE
    • MOODLE_36_STABLE
    • 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).

      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.

        1. case_a_the_hyphen.txt
          89 kB
          Eloy Lafuente (stronk7)
        2. case_a_the_hyphen_failed_php71.txt
          60 kB
          Eloy Lafuente (stronk7)
        3. case_a_the_hyphen_ok_php71.txt
          43 kB
          Eloy Lafuente (stronk7)
        4. case_a_the_hyphen_failed_php71_reduced.txt
          28 kB
          Eloy Lafuente (stronk7)
        5. case_a_the_hyphen_ok_php73.txt
          49 kB
          Eloy Lafuente (stronk7)
        6. case_a_the_hyphen_failed_php73.txt
          0.1 kB
          Eloy Lafuente (stronk7)
        7. simple_regexp_parser.php
          1.0 kB
          Eloy Lafuente (stronk7)

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Damyon Wiese Damyon Wiese
            Andrew Lyons Andrew Lyons
            Andrew Lyons Andrew Lyons
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.