diff --git a/src/lib/eZ/RichText/Converter/Render.php b/src/lib/eZ/RichText/Converter/Render.php index f6fe0dd2..c73490df 100644 --- a/src/lib/eZ/RichText/Converter/Render.php +++ b/src/lib/eZ/RichText/Converter/Render.php @@ -55,12 +55,16 @@ protected function extractConfiguration(DOMElement $embed) * * @param \DOMNode $configHash * - * @return array + * @return array|null */ protected function extractHash(DOMNode $configHash) { $hash = []; + if ($configHash->childNodes->count() === 0) { + return null; + } + foreach ($configHash->childNodes as $node) { /** @var \DOMText|\DOMElement $node */ if ($node->nodeType === XML_ELEMENT_NODE) { diff --git a/tests/lib/eZ/RichText/Converter/Render/EmbedTest.php b/tests/lib/eZ/RichText/Converter/Render/EmbedTest.php index 4b1615b9..de4d8166 100644 --- a/tests/lib/eZ/RichText/Converter/Render/EmbedTest.php +++ b/tests/lib/eZ/RichText/Converter/Render/EmbedTest.php @@ -741,6 +741,56 @@ public function providerForTestConvert(): array ['601', '602'], ], ], + [ + ' +
+ Here is paragraph with embed with empty config value + + + value1 + + + + +
', + ' +
+ Here is paragraph with embed with empty config value + + + value1 + + + + + +
', + [], + [ + [], + [], + ], + [ + [ + [ + 'id' => '601', + 'viewType' => 'embed', + [ + 'embedParams' => [ + 'id' => '601', + 'viewType' => 'embed', + 'config' => [ + 'non-empty' => 'value1', + 'empty' => null, + ], + ], + ], + 'is_inline' => false, + ], + ], + ['601'], + ], + ], ]; } diff --git a/tests/lib/eZ/RichText/Converter/Render/TemplateTest.php b/tests/lib/eZ/RichText/Converter/Render/TemplateTest.php index 21e71dc1..4d9cb565 100644 --- a/tests/lib/eZ/RichText/Converter/Render/TemplateTest.php +++ b/tests/lib/eZ/RichText/Converter/Render/TemplateTest.php @@ -289,6 +289,7 @@ protected function getConverterMock() 'content' => 'Param: value', 'params' => [ 'param' => 'value', + 'empty' => null, ], 'align' => 'right', ], diff --git a/tests/lib/eZ/RichText/Converter/Render/_fixtures/template/input/05-block-content-config.xml b/tests/lib/eZ/RichText/Converter/Render/_fixtures/template/input/05-block-content-config.xml index adf5d2c9..cc52a537 100644 --- a/tests/lib/eZ/RichText/Converter/Render/_fixtures/template/input/05-block-content-config.xml +++ b/tests/lib/eZ/RichText/Converter/Render/_fixtures/template/input/05-block-content-config.xml @@ -4,6 +4,7 @@ Param: value value + diff --git a/tests/lib/eZ/RichText/Converter/Render/_fixtures/template/output/05-block-content-config.xml b/tests/lib/eZ/RichText/Converter/Render/_fixtures/template/output/05-block-content-config.xml index ebc1aeaa..9cbaddab 100644 --- a/tests/lib/eZ/RichText/Converter/Render/_fixtures/template/output/05-block-content-config.xml +++ b/tests/lib/eZ/RichText/Converter/Render/_fixtures/template/output/05-block-content-config.xml @@ -6,6 +6,7 @@ value + custom_tag