diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index c3945167370628df630b6d1bbd45cf3355b40cd6..54824de3cb5aaff2590afa02a5805b7350c8d16e 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -1960,7 +1960,7 @@ class ContentObjectRenderer implements LoggerAwareInterface */ public function stdWrap_bytes($content = '', $conf = []) { - return GeneralUtility::formatSize((int)$content, $conf['bytes.']['labels'], $conf['bytes.']['base']); + return GeneralUtility::formatSize((int)$content, $conf['bytes.']['labels'] ?? '', $conf['bytes.']['base'] ?? 0); } /** diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php index 52cdf14b94a272b51c9c2d32135268bb52e9520c..2d01fd4ef92d85639641931711a3b1683740ce62 100644 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php @@ -3838,12 +3838,12 @@ class ContentObjectRendererTest extends UnitTestCase * - Almost all stdWrap_[type] are callable if called with 2 parameters: * - string $content Empty string. * - array $conf ['type' => '', 'type.' => []]. - * - Exceptions: stdWrap_numRows, stdWrap_split + * - Exceptions: stdWrap_numRows * - The overall count is 91. * * Note: * - * The two exceptions break, if the configuration is empty. This test just + * The exceptions break, if the configuration is empty. This test just * tracks the different behaviour to gain information. It doesn't mean * that it is an issue. * @@ -3857,7 +3857,7 @@ class ContentObjectRendererTest extends UnitTestCase $linkFactory->create(Argument::cetera())->willReturn(new LinkResult('', '')); GeneralUtility::addInstance(LinkFactory::class, $linkFactory->reveal()); - $expectExceptions = ['numRows', 'bytes']; + $expectExceptions = ['numRows']; $count = 0; $processors = []; $exceptions = []; @@ -4276,6 +4276,16 @@ class ContentObjectRendererTest extends UnitTestCase '1234567890', ['labels' => '', 'base' => 0], ], + 'value 1234 iec no base' => [ + '1.21 Ki', + '1234', + ['labels' => 'iec'], + ], + 'value 1234 no labels base set' => [ + '1.21 Ki', + '1234', + ['base' => 0], + ], ]; }