From 6b83451251208fd1382dfcf306742b86e0247161 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 27 Oct 2019 00:15:48 +0200 Subject: [PATCH 1/4] MDL-67034 horde: php74 fix (curly braces) for the Horde lib --- lib/horde/framework/Horde/Crypt/Blowfish/Php/Base.php | 2 +- lib/horde/readme_moodle.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/horde/framework/Horde/Crypt/Blowfish/Php/Base.php b/lib/horde/framework/Horde/Crypt/Blowfish/Php/Base.php index 1e212bf735e..3ee9235cd47 100644 --- a/lib/horde/framework/Horde/Crypt/Blowfish/Php/Base.php +++ b/lib/horde/framework/Horde/Crypt/Blowfish/Php/Base.php @@ -328,7 +328,7 @@ abstract class Horde_Crypt_Blowfish_Php_Base for ($i = 0; $i < 18; ++$i) { $data = 0; for ($j = 4; $j > 0; --$j) { - $data = $data << 8 | ord($key{$k}); + $data = $data << 8 | ord($key[$k]); $k = ($k + 1) % $len; } $this->_P[$i] ^= $data; diff --git a/lib/horde/readme_moodle.txt b/lib/horde/readme_moodle.txt index 8d5ffab5b4a..c31e9808f95 100644 --- a/lib/horde/readme_moodle.txt +++ b/lib/horde/readme_moodle.txt @@ -15,6 +15,7 @@ Description of import of Horde libraries # Verify that these patches have been applied in the imported version. Apply them locally if not: - https://github.com/horde/Mail/pull/1 (Mail component). - https://github.com/horde/Imap_Client/pull/6 (IMAP Client component). + - https://github.com/horde/Crypt_Blowfish/pull/1 (PHP 7.4 compatibility, Crypt_Blowfish) ==== #!/bin/sh @@ -38,4 +39,4 @@ do then cp -Rf $locale/* $target/locale fi -done \ No newline at end of file +done From 15c8da60d416fea70160b4c086672bc431b46136 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 27 Oct 2019 00:18:05 +0200 Subject: [PATCH 2/4] MDL-67034 adodb: php74 fix (curly braces) for the AdoDB lib --- lib/adodb/drivers/adodb-oci8po.inc.php | 2 +- lib/adodb/readme_moodle.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/adodb/drivers/adodb-oci8po.inc.php b/lib/adodb/drivers/adodb-oci8po.inc.php index 768776026d0..2c785fd29da 100644 --- a/lib/adodb/drivers/adodb-oci8po.inc.php +++ b/lib/adodb/drivers/adodb-oci8po.inc.php @@ -120,7 +120,7 @@ class ADODB_oci8po extends ADODB_oci8 { /* * find the next character of the string */ - $c = $sql{$i}; + $c = $sql[$i]; if ($c == "'" && !$inString && $escaped==0) /* diff --git a/lib/adodb/readme_moodle.txt b/lib/adodb/readme_moodle.txt index 3131a6cd6db..35c450a12b6 100644 --- a/lib/adodb/readme_moodle.txt +++ b/lib/adodb/readme_moodle.txt @@ -30,5 +30,6 @@ Our changes: * Removed random seed initialization from lib/adodb/adodb.inc.php:216 (see 038f546 and MDL-41198). * MDL-52286 Added muting erros in ADORecordSet::__destruct(). Check if fixed upstream during the next upgrade and remove this note. (8638b3f1441d4b928) + * MDL-67034 Fixes to make the library php74 compliant. skodak, iarenaza, moodler, stronk7, abgreeve, lameze, ankitagarwal, marinaglancy From b69028e6264eddffb841895ddbe61b0f74cde389 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 27 Oct 2019 00:21:56 +0200 Subject: [PATCH 3/4] MDL-67034 google: php74 fix (curly braces) for the Google-Client lib --- lib/google/readme_moodle.txt | 3 +++ lib/google/src/Google/Utils.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/google/readme_moodle.txt b/lib/google/readme_moodle.txt index c9253a229ab..15358b7e921 100644 --- a/lib/google/readme_moodle.txt +++ b/lib/google/readme_moodle.txt @@ -36,6 +36,9 @@ Here are the files that we have added. This should not ever be used directly. The wrapper above uses it automatically. +Local changes (to reapply until upstream upgrades contain them): + * MDL-67034 php74 compliance fixes + Information ----------- diff --git a/lib/google/src/Google/Utils.php b/lib/google/src/Google/Utils.php index 2803daaa109..2366d4d5ae7 100644 --- a/lib/google/src/Google/Utils.php +++ b/lib/google/src/Google/Utils.php @@ -62,7 +62,7 @@ class Google_Utils $strlenVar = strlen($str); $d = $ret = 0; for ($count = 0; $count < $strlenVar; ++ $count) { - $ordinalValue = ord($str{$ret}); + $ordinalValue = ord($str[$ret]); switch (true) { case (($ordinalValue >= 0x20) && ($ordinalValue <= 0x7F)): // characters U-00000000 - U-0000007F (same as ASCII) From 20d4ecc4092e0710c47bf63c23df7020166ac1ef Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 27 Oct 2019 00:25:54 +0200 Subject: [PATCH 4/4] MDL-67034 lti_provider: php74 fix (curly braces) for LTI Provider lib --- lib/ltiprovider/readme_moodle.txt | 4 ++++ lib/ltiprovider/src/OAuth/OAuthSignatureMethod.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ltiprovider/readme_moodle.txt b/lib/ltiprovider/readme_moodle.txt index 89c9e208ffe..a552efdda81 100644 --- a/lib/ltiprovider/readme_moodle.txt +++ b/lib/ltiprovider/readme_moodle.txt @@ -13,6 +13,10 @@ These changes can be reverted once the following pull requests have been integra * https://github.com/IMSGlobal/LTI-Tool-Provider-Library-PHP/pull/47 * https://github.com/IMSGlobal/LTI-Tool-Provider-Library-PHP/pull/48 +This local changes can be reverted once it's checked that they are present upstream (note the +LTI-Tool-Provider-Library-PHP repo has been archived so it doesn't accept pull requests anymore): +* MDL-67034 php74 compliance fixes + It is recommended by upstream to install depdencies via composer - but the composer installation is bundled with an autoloader so it's better to do it manually. diff --git a/lib/ltiprovider/src/OAuth/OAuthSignatureMethod.php b/lib/ltiprovider/src/OAuth/OAuthSignatureMethod.php index 8fae1ed519b..db5b691fa17 100644 --- a/lib/ltiprovider/src/OAuth/OAuthSignatureMethod.php +++ b/lib/ltiprovider/src/OAuth/OAuthSignatureMethod.php @@ -56,7 +56,7 @@ abstract class OAuthSignatureMethod { // Avoid a timing leak with a (hopefully) time insensitive compare $result = 0; for ($i = 0; $i < strlen($signature); $i++) { - $result |= ord($built{$i}) ^ ord($signature{$i}); + $result |= ord($built[$i]) ^ ord($signature[$i]); } return $result == 0;