From c599d8a0ede1b0ab619e16295f5c2363f0733193 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 27 Mar 2024 13:04:42 +0100 Subject: [PATCH] Make sure tags fallback to empty array when null --- module/Core/src/ShortUrl/Model/ShortUrlCreation.php | 2 +- module/Core/src/ShortUrl/Model/ShortUrlEdition.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/Core/src/ShortUrl/Model/ShortUrlCreation.php b/module/Core/src/ShortUrl/Model/ShortUrlCreation.php index b0c87f99..f5336075 100644 --- a/module/Core/src/ShortUrl/Model/ShortUrlCreation.php +++ b/module/Core/src/ShortUrl/Model/ShortUrlCreation.php @@ -68,7 +68,7 @@ final readonly class ShortUrlCreation implements TitleResolutionModelInterface ShortUrlInputFilter::SHORT_CODE_LENGTH, ) ?? DEFAULT_SHORT_CODES_LENGTH, apiKey: $inputFilter->getValue(ShortUrlInputFilter::API_KEY), - tags: $inputFilter->getValue(ShortUrlInputFilter::TAGS), + tags: $inputFilter->getValue(ShortUrlInputFilter::TAGS) ?? [], title: $inputFilter->getValue(ShortUrlInputFilter::TITLE), crawlable: $inputFilter->getValue(ShortUrlInputFilter::CRAWLABLE), forwardQuery: getOptionalBoolFromInputFilter($inputFilter, ShortUrlInputFilter::FORWARD_QUERY) ?? true, diff --git a/module/Core/src/ShortUrl/Model/ShortUrlEdition.php b/module/Core/src/ShortUrl/Model/ShortUrlEdition.php index 36a99f5f..6296f84d 100644 --- a/module/Core/src/ShortUrl/Model/ShortUrlEdition.php +++ b/module/Core/src/ShortUrl/Model/ShortUrlEdition.php @@ -60,7 +60,7 @@ final readonly class ShortUrlEdition implements TitleResolutionModelInterface maxVisitsPropWasProvided: array_key_exists(ShortUrlInputFilter::MAX_VISITS, $data), maxVisits: getOptionalIntFromInputFilter($inputFilter, ShortUrlInputFilter::MAX_VISITS), tagsPropWasProvided: array_key_exists(ShortUrlInputFilter::TAGS, $data), - tags: $inputFilter->getValue(ShortUrlInputFilter::TAGS), + tags: $inputFilter->getValue(ShortUrlInputFilter::TAGS) ?? [], titlePropWasProvided: array_key_exists(ShortUrlInputFilter::TITLE, $data), title: $inputFilter->getValue(ShortUrlInputFilter::TITLE), crawlablePropWasProvided: array_key_exists(ShortUrlInputFilter::CRAWLABLE, $data),