From a7a45aeb9d297e541463f4d0ca58c03baed0c110 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Tue, 26 Nov 2024 14:49:34 +0000 Subject: [PATCH 1/2] wrap League's Uri instantiation in try catch --- src/fields/linktypes/Url.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fields/linktypes/Url.php b/src/fields/linktypes/Url.php index b1292286ba5..d87e4d4bf20 100644 --- a/src/fields/linktypes/Url.php +++ b/src/fields/linktypes/Url.php @@ -76,8 +76,13 @@ protected function inputAttributes(): array public function validateValue(string $value, ?string &$error = null): bool { - // Leveraging Uri package to convert domains to punycode - return parent::validateValue(Uri::new($value), $error); + try { + // Leveraging Uri package to convert domains to punycode + $value = Uri::new($value); + return parent::validateValue($value, $error); + } catch (\Exception $e) { + return false; + } } protected function pattern(): string From 604a7d18055c94759d24aa0a882b79445fe734c2 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 27 Nov 2024 15:10:03 -0800 Subject: [PATCH 2/2] Release note [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d93b2ded10..dce385b1369 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fixed an error that could occur when duplicating an element with an Assets field that had a dynamic subpath. ([#16214](https://github.com/craftcms/cms/issues/16214)) - Fixed a bug where element slideouts had Save buttons even if the user didn’t have permission to save the element. ([#16205](https://github.com/craftcms/cms/pull/16205)) - Fixed a bug where pagination wasn’t working properly on the Entry Types index page when searching. ([#16204](https://github.com/craftcms/cms/issues/16204)) +- Fixed an error that could occur when saving an element with an invalid Link field value. ([#16212](https://github.com/craftcms/cms/issues/16212)) ## 5.5.3 - 2024-11-22