1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Fix PHP 8.1 Fatal error in Figlet: Use square brackets instead of curly braces

Summary:
Replace curly with square brackets when accessing an array value. See
https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.array-string-access-curly-brace
https://wiki.php.net/rfc/deprecate_curly_braces_array_access#wasn_t_the_curly_brace_syntax_deprecated_once_before

Closes T15406

Test Plan:
Fixed these two lines; afterwards Figlet rendered in task comment preview. Example figlet:

```
figlet {{{ stuff }}}
```

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15406

Differential Revision: https://we.phorge.it/D25233
This commit is contained in:
Andre Klapper 2023-05-20 17:42:30 +02:00
parent 94d45de2f7
commit f97c9d68d0

View file

@ -231,7 +231,7 @@ class Text_Figlet
$i = hexdec(substr($i, 2));
} else {
// If octal
if ($i{0} === '0' && $i !== '0' || substr($i, 0, 2) == '-0') {
if ($i[0] === '0' && $i !== '0' || substr($i, 0, 2) == '-0') {
$i = octdec($i);
}
}
@ -274,7 +274,7 @@ class Text_Figlet
$lt = hexdec(substr($str, $i+2, 4));
$i += 5;
} else {
$lt = ord($str{$i});
$lt = ord($str[$i]);
}
$hb = preg_quote($this->hardblank, '/');