From 92af5482c7ea65970b44d7b50d20790c30ee7708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 17 Nov 2020 18:36:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Client/ClientAbstracts.php | 1 - function.php | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/HttpServer/Client/ClientAbstracts.php b/HttpServer/Client/ClientAbstracts.php index c4b4947a..576f892f 100644 --- a/HttpServer/Client/ClientAbstracts.php +++ b/HttpServer/Client/ClientAbstracts.php @@ -706,7 +706,6 @@ abstract class ClientAbstracts extends Component implements IClient */ protected function matchHost(string $string) { - var_dump($string); if (($parse = isUrl($string, true)) === false) { return $this->defaultString($string); } diff --git a/function.php b/function.php index 4d8a9b83..1a105849 100644 --- a/function.php +++ b/function.php @@ -46,11 +46,14 @@ if (!function_exists('isUrl')) { */ function isUrl($url, $get_info = true) { - $queryMatch = '/((http[s]?):\/\/)?(([\w-_]+\.)+\w+(:\d+)?)(\/.*)?/'; - if (!preg_match($queryMatch, $url, $outPut)) { + try { + $queryMatch = '/((http[s]?):\/\/)?(([\w-_]+\.)+\w+(:\d+)?)(\/.*)?/'; + if (!preg_match($queryMatch, $url, $outPut)) { + return false; + } + }catch (Throwable $exception){ return false; } - $port = str_replace(':', '', $outPut[5]); [$isHttps, $domain, $port, $path] = [$outPut[2] == 'https', $outPut[3], $port, $outPut[6] ?? ''];