From 887ac886a5ac3c1feeb9b8881ceb7424b5e5ed90 Mon Sep 17 00:00:00 2001 From: Ernesto Baschny Date: Fri, 24 Apr 2020 17:17:43 +0200 Subject: [PATCH] Make sure to use only a consistent NumbersReaderCache 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. Same fix was already applied to DatesReader, see: https://github.com/neos/flow-development-collection/pull/1899 --- Neos.Flow/Classes/I18n/Cldr/Reader/NumbersReader.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Neos.Flow/Classes/I18n/Cldr/Reader/NumbersReader.php b/Neos.Flow/Classes/I18n/Cldr/Reader/NumbersReader.php index 7e3d081e66..c8dd72e9fc 100644 --- a/Neos.Flow/Classes/I18n/Cldr/Reader/NumbersReader.php +++ b/Neos.Flow/Classes/I18n/Cldr/Reader/NumbersReader.php @@ -223,8 +223,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]; } if ($formatLength === self::FORMAT_LENGTH_DEFAULT) {