diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 2384d09d6c..bbe3d3dc12 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1010,7 +1010,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; } diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index e1bbd89f12..6073eac6fe 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -28,7 +28,8 @@ class phpbb_error_collector_test extends phpbb_test_case $collector->install(); // Cause a warning - 1/0; $line = __LINE__; + // Division by zero was promoted to fatal error and throws DivisionByZeroError exception in PHP 8+ + version_compare(PHP_VERSION, '8', '>=') ? '1b'['0xFF'] : 1/0; $line = __LINE__; $collector->uninstall(); @@ -39,7 +40,7 @@ class phpbb_error_collector_test extends phpbb_test_case // Unfortunately $error_contents will contain the full path here, // because the tests directory is outside of phpbb root path. - $this->assertStringStartsWith('Errno 2: Division by zero at ', $error_contents); + $this->assertStringStartsWith(version_compare(PHP_VERSION, '8', '>=') ? 'Errno 2: Illegal string offset "0xFF" at ' : 'Errno 2: Division by zero at ', $error_contents); $this->assertStringEndsWith(" line $line", $error_contents); } @@ -49,7 +50,8 @@ class phpbb_error_collector_test extends phpbb_test_case $collector->install(); // Cause a warning - 1/0; $line = __LINE__; + // Division by zero was promoted to fatal error and throws DivisionByZeroError exception in PHP 8+ + version_compare(PHP_VERSION, '8', '>=') ? '1b'['0xFF'] : 1/0; $line = __LINE__; // Cause a "Notice: unserialize(): Error at offset 0 of 27 bytes in ..." // "Undefined array index" used earlier was promoted to warning in PHP 8.0, @@ -69,7 +71,7 @@ class phpbb_error_collector_test extends phpbb_test_case // Unfortunately $error_contents will contain the full path here, // because the tests directory is outside of phpbb root path. - $this->assertStringStartsWith('Errno 2: Division by zero at ', $error_contents); + $this->assertStringStartsWith(version_compare(PHP_VERSION, '8', '>=') ? 'Errno 2: Illegal string offset "0xFF" at ' : 'Errno 2: Division by zero at ', $error_contents); $this->assertStringEndsWith(" line $line", $error_contents); } } diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php index 17c4ae22dd..31513d0f31 100644 --- a/tests/mock/container_builder.php +++ b/tests/mock/container_builder.php @@ -59,7 +59,7 @@ class phpbb_mock_container_builder implements ContainerInterface if ($this->has($id)) { $service = $this->services[$id]; - if (is_array($service) && is_callable($service[0])) + if (is_array($service) && isset($service[0]) && is_callable($service[0])) { return call_user_func_array($service[0], $service[1]); }