From 9bdb88879da75e31883817f42b2f1f8ea54f3626 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 4 Mar 2025 09:53:19 +0700 Subject: [PATCH 1/3] [ticket/17480] Properly catch RuntimeException if no http handler is available PHPBB-17480 --- phpBB/phpbb/file_downloader.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/file_downloader.php b/phpBB/phpbb/file_downloader.php index 0dcb3e5854..3f87c9c512 100644 --- a/phpBB/phpbb/file_downloader.php +++ b/phpBB/phpbb/file_downloader.php @@ -75,8 +75,15 @@ class file_downloader */ public function get(string $host, string $directory, string $filename, int $port = 443, int $timeout = 6) { - // Initialize Guzzle client - $client = $this->create_client($host, $port, $timeout); + try + { + // Initialize Guzzle client + $client = $this->create_client($host, $port, $timeout); + } + catch (\RuntimeException $exception) + { + throw new runtime_exception($exception->getMessage()); + } // Set default values for error variables $this->error_number = 0; From 1ea59731f047ae281d95854e4b06cf6e85b76a97 Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 5 Mar 2025 10:10:29 +0700 Subject: [PATCH 2/3] [ticket/17480] Use phpBB error message text instead of thrown by GuzzleHTTP PHPBB-17480 --- phpBB/language/en/common.php | 1 + phpBB/phpbb/file_downloader.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 5694bbd5dc..5cdba377f5 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -357,6 +357,7 @@ $lang = array_merge($lang, array( 'HIDE_ME' => 'Hide my online status this session', 'HOURS' => 'Hours', 'HOME' => 'Home', + 'HTTP_HANDLER_NOT_FOUND' => 'The operation could not be completed because cURL PHP extension and allow_url_fopen PHP ini setting have been disabled and no other HTTP handler could be found.', 'ICQ' => 'ICQ', 'IF' => 'If', diff --git a/phpBB/phpbb/file_downloader.php b/phpBB/phpbb/file_downloader.php index 3f87c9c512..e2becbfbfa 100644 --- a/phpBB/phpbb/file_downloader.php +++ b/phpBB/phpbb/file_downloader.php @@ -82,7 +82,7 @@ class file_downloader } catch (\RuntimeException $exception) { - throw new runtime_exception($exception->getMessage()); + throw new runtime_exception('HTTP_HANDLER_NOT_FOUND'); } // Set default values for error variables From 0826a41da86e5ba9ef7e36a30cbf7c811ee7b9b5 Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 8 Mar 2025 11:01:47 +0700 Subject: [PATCH 3/3] [ticket/17480] Adjust message wording PHPBB-17480 --- phpBB/language/en/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 5cdba377f5..f5fad1b28e 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -357,7 +357,7 @@ $lang = array_merge($lang, array( 'HIDE_ME' => 'Hide my online status this session', 'HOURS' => 'Hours', 'HOME' => 'Home', - 'HTTP_HANDLER_NOT_FOUND' => 'The operation could not be completed because cURL PHP extension and allow_url_fopen PHP ini setting have been disabled and no other HTTP handler could be found.', + 'HTTP_HANDLER_NOT_FOUND' => 'The operation could not be completed because the cURL PHP extension and allow_url_fopen PHP ini setting have been disabled and no other HTTP handler could be found.', 'ICQ' => 'ICQ', 'IF' => 'If',