From 71f85350dae68b4d518cd1186ff96c097ebcae89 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 3 Feb 2021 11:28:40 +0100 Subject: [PATCH] Fixed regex to parse title from URL to consider possible attributes --- module/Core/src/Util/UrlValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/Core/src/Util/UrlValidator.php b/module/Core/src/Util/UrlValidator.php index 1f590de5..e1ae159b 100644 --- a/module/Core/src/Util/UrlValidator.php +++ b/module/Core/src/Util/UrlValidator.php @@ -51,7 +51,7 @@ class UrlValidator implements UrlValidatorInterface, RequestMethodInterface } $body = $response->getBody()->__toString(); - preg_match('/(.+)<\/title>/i', $body, $matches); + preg_match('/<title[^>]*>(.*?)<\/title>/i', $body, $matches); return $matches[1] ?? null; }