From 220bbe3f41d699d0af68ab36a964220ba2f4884e Mon Sep 17 00:00:00 2001 From: Ernesto Baschny Date: Mon, 20 Jan 2020 16:14:10 +0100 Subject: [PATCH] Make sure to use only a consistent DatesReaderCache It might happen that there is a discrepancy between parsedFormatsIndices and parsedFormats cache. Make sure we are accessing the consistent information instead of relying that both are there, to avoid a PHP exception. --- Neos.Flow/Classes/I18n/Cldr/Reader/DatesReader.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Neos.Flow/Classes/I18n/Cldr/Reader/DatesReader.php b/Neos.Flow/Classes/I18n/Cldr/Reader/DatesReader.php index fb872e2169..9f2cc44144 100644 --- a/Neos.Flow/Classes/I18n/Cldr/Reader/DatesReader.php +++ b/Neos.Flow/Classes/I18n/Cldr/Reader/DatesReader.php @@ -261,8 +261,9 @@ public function parseFormatFromCldr(Locale $locale, $formatType, $formatLength) self::validateFormatType($formatType); self::validateFormatLength($formatLength); - if (isset($this->parsedFormatsIndices[(string)$locale][$formatType][$formatLength])) { - return $this->parsedFormats[$this->parsedFormatsIndices[(string)$locale][$formatType][$formatLength]]; + $parsedFormatIndex = $this->parsedFormatsIndices[(string)$locale][$formatType][$formatLength] ?? ''; + if (isset($this->parsedFormats[$parsedFormatIndex])) { + return $this->parsedFormats[$parsedFormatIndex]; } $model = $this->cldrRepository->getModelForLocale($locale);