MDL-68589 plist: PHP 7.4 curly bracket fixes
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sat, 2 May 2020 23:05:10 +0000 (01:05 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sat, 2 May 2020 23:05:10 +0000 (01:05 +0200)
Note this is, partially, https://github.com/TECLIB/CFPropertyList/pull/61

I only have applied the stricly required PHP 7.4 changes, keeping
apart the intval() ==> (int) change, because that's unrelated to
this fix.

lib/plist/classes/CFPropertyList/CFBinaryPropertyList.php

index 34cb708..4c34006 100644 (file)
@@ -801,7 +801,7 @@ abstract class CFBinaryPropertyList {
    */
   protected static function binaryStrlen($val) {
     for($i=0;$i<strlen($val);++$i) {
-      if(ord($val{$i}) >= 128) {
+      if(ord($val[$i]) >= 128) {
         $val = self::convertCharset($val, 'UTF-8', 'UTF-16BE');
         return strlen($val);
       }
@@ -824,7 +824,7 @@ abstract class CFBinaryPropertyList {
       $utf16 = false;
 
       for($i=0;$i<strlen($val);++$i) {
-        if(ord($val{$i}) >= 128) {
+        if(ord($val[$i]) >= 128) {
           $utf16 = true;
           break;
         }