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.
This commit is contained in:
Nicky Galliano 2021-02-05 10:11:06 +00:00
parent cea71d42c3
commit 2bc76d8bae

View File

@ -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;
}