1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/16549] Fix tests

1. If $service array is empty, $service[0] call will throw fatal error in PHP 8.
2. Division by zero was promoted to fatal error
and throws DivisionByZeroError exception in PHP 8+
3. Adjust make_clickable() logic to avoid 'Undefined array key 3' error.

PHPBB3-16549
This commit is contained in:
rxu
2020-10-18 14:47:03 +07:00
parent fff200b1d8
commit fe38280a1a
3 changed files with 8 additions and 6 deletions

View File

@@ -1011,7 +1011,7 @@ function make_clickable($text, $server_url = false, string $class = 'postlink')
if (preg_match($magic_args[0], $text, $matches))
{
// Only apply $class from the corresponding function call argument (excepting emails which never has a class)
if ($magic_args[3] != $static_class && $magic_args[1] != MAGIC_URL_EMAIL)
if ($magic_args[1] != MAGIC_URL_EMAIL && $magic_args[3] != $static_class)
{
continue;
}