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

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.8, 3.9
    • Fix Version/s: 3.8.1
    • Component/s: General, Libraries
    • Labels:
    • Testing Instructions:
      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).
    • Affected Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull Master Branch:

      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

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Peer reviewer:
            Mathew May
            Integrator:
            Jake Dallimore
            Tester:
            Gladys Basiana
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              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