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

Required changes to make adodb, google, horde & lti provider libs PHP 7.4 compliant (curly braces)

XMLWordPrintable

    • 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/adodb lib/google lib/horde lib/ltiprovider --php
      

      1. Verify that you get ZERO matches, that means that there aren't remaining cases.
      2. Using moodle-docker (or any >= PHP7.4 RC4 installation) install phpunit (init.php).
      3. Verify that there isn't any PHP notice/warning related with adodb, google, horde, ltiprovider stuff. (Be warned that there may be lots of notices/warnings/errors, here we are only interested in the adodb, google, horde, ltiprovider ones).
      4. Run phpunit (with that PHP7.4 version).
      5. Verify that there isn't any PHP notice/warning related with adodb, google, horde, ltiprovider. (Be warned that there are lots of notices/warning/errors and failures, here we are only interested in the adodb, google, horde, ltiprovider ones
      6. Verify that travis is passing for php71 and php73 (specifically adodb, google, horde, ltiprovider ones).
      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/adodb lib/google lib/horde lib/ltiprovider --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 adodb, google, horde, ltiprovider stuff. (Be warned that there may be lots of notices/warnings/errors, here we are only interested in the adodb, google, horde, ltiprovider ones). Run phpunit (with that PHP7.4 version). Verify that there isn't any PHP notice/warning related with adodb, google, horde, ltiprovider. (Be warned that there are lots of notices/warning/errors and failures, here we are only interested in the adodb, google, horde, ltiprovider ones Verify that travis is passing for php71 and php73 (specifically adodb, google, horde, ltiprovider ones).

      We have glued 4 libraries here because changes are minimal (1-line change) + readme documenting it.

      In none of the case we are upgrading the libraries because 1) or the patch has not been merged upstream or 2) the libraries are so outdated that there isn't a clear upgrade/replacement for them.

      About the case 2) above, I've created MDL-67033, because we need to decide urgently about some of them.

      These are the 4 changes, related to php74 curly braces, that we need to fix. As commented above, the corresponding readme files will be updated to include a call to this (or to the upstream pull request, if there is any).

      lib/adodb/drivers/adodb-oci8po.inc.php:123:			$c = $sql{$i};
      lib/google/src/Google/Utils.php:65:      $ordinalValue = ord($str{$ret});
      lib/horde/framework/Horde/Crypt/Blowfish/Php/Base.php:331:                $data = $data << 8 | ord($key{$k});
      lib/ltiprovider/src/OAuth/OAuthSignatureMethod.php:59:            $result |= ord($built{$i}) ^ ord($signature{$i});
      

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Mathew May Mathew May
            Jake Dallimore Jake Dallimore
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 30 minutes
                2h 30m

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