Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-66319 Remove curly brace syntax for accessing array elements and string offsets
  3. MDL-67030

Required changes to make htmlpurifier lib PHP 7.4 compliant (curly braces)

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.8, 3.9
    • 3.8.1
    • General, Libraries
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_38_STABLE
    • Hide
      1. run the following command (requires ag, although advanced grep versions should be able to run it, after all, it's just a regular expression:
        N.b. If you have ack, you should be able to replace ag with ack in the command below. (sudo apt-get install ack)

        $ ag '(\$[0-9a-zA-Z_]+|\))(\[['\''"\w$]+\])?{[^\n=}]+}'  lib/htmlpurifier --php
        

      2. Verify that you get ZERO matches, that means that there aren't remaining cases.
      3. Using moodle-docker (or any >= PHP7.4 RC4 installation) install phpunit (init.php).
      4. Verify that there isn't any PHP notice/warning related with lib/htmlpurifier stuff. (Be warned that there may be lots of notices/warnings/errors, here we are only interested in the lib/htmlpurifier ones).
      5. Run phpunit (with that PHP7.4 version).
      6. Verify that there isn't any PHP notice/warning related with lib/htmlpurifier. (Be warned that there are lots of notices/warning/errors and failures, here we are only interested in the lib/htmlpurifier ones
      7. Verify that travis is passing for php71 and php73 (specifically core_htmlpurifier_testcase).
      Show
      run the following command (requires ag , although advanced grep versions should be able to run it, after all, it's just a regular expression: N.b. If you have ack, you should be able to replace ag with ack in the command below. (sudo apt-get install ack) $ ag '(\$[0-9a-zA-Z_]+|\))(\[['\''"\w$]+\])?{[^\n=}]+}' lib/htmlpurifier --php Verify that you get ZERO matches, that means that there aren't remaining cases. Using moodle-docker (or any >= PHP7.4 RC4 installation) install phpunit (init.php). Verify that there isn't any PHP notice/warning related with lib/htmlpurifier stuff. (Be warned that there may be lots of notices/warnings/errors, here we are only interested in the lib/htmlpurifier ones). Run phpunit (with that PHP7.4 version). Verify that there isn't any PHP notice/warning related with lib/htmlpurifier. (Be warned that there are lots of notices/warning/errors and failures, here we are only interested in the lib/htmlpurifier ones Verify that travis is passing for php71 and php73 (specifically core_htmlpurifier_testcase).

    Description

      We are currently using htmlpurifier v4.10.0. And it's not php74 compliant.

      Latests htmlpurifier release v4.11.0 is not compliant either.

      There is this PR that fixes the curly braces problem, but still no release with it.

      So we are going to keep v4.10.0 and apply the PR above manually, documenting it for whenever a new library update is performed.

      Attachments

        Activity

          People

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Mathew May Mathew May
            Jake Dallimore Jake Dallimore
            Gladys Basiana Gladys Basiana
            Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              13/Jan/20

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 55 minutes
                1h 55m