From: Nicky Galliano Date: Fri, 5 Feb 2021 10:11:06 +0000 (+0000) Subject: Update functions.php. X-Git-Tag: 4.4.0~7 X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/commitdiff_plain/2bc76d8baee16b7ba0814c12da52c665158a6d98?hp=cea71d42c3eafae9cb41017f24a12d6c84d9c80a Update functions.php. Following the update to php 8, I got the following debug error when trying to access my instance : "Array and string offset access syntax with curly braces is no longer supported in [...]/jirafeau/lib/functions.php on line 31" I just changed the deprecated curly braces into brackets and I was good to go. --- diff --git a/lib/functions.php b/lib/functions.php index a4f9ec6..f564db6 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -28,7 +28,7 @@ function s2p($s) $block_size = 8; $p = ''; for ($i = 0; $i < strlen($s); $i++) { - $p .= $s{$i}; + $p .= $s[$i]; if (($i + 1) % $block_size == 0) { $p .= '/'; } @@ -68,16 +68,16 @@ function base_16_to_64($num) # Convert long hex string to bin. $size = strlen($num); for ($i = 0; $i < $size; $i++) { - $b .= $hex2bin{hexdec($num{$i})}; + $b .= $hex2bin[hexdec($num[$i])]; } # Convert long bin to base 64. $size *= 4; for ($i = $size - 6; $i >= 0; $i -= 6) { - $o = $m{bindec(substr($b, $i, 6))} . $o; + $o = $m[bindec(substr($b, $i, 6))] . $o; } # Some few bits remaining ? if ($i < 0 && $i > -6) { - $o = $m{bindec(substr($b, 0, $i + 6))} . $o; + $o = $m[bindec(substr($b, 0, $i + 6))] . $o; } return $o; }