| Q |
A |
| Sulu Version |
3.0.9 |
| PHP Version |
8.3.33 |
| DB Version |
10.11.7-MariaDB |
| Browser Version |
Chrome 151 |
Actual Behavior
Have a article smart_content property with configuration like this:
<property name="news" type="smart_content">
<meta>
<title lang="en">Atricles</title>
</meta>
<params>
<param name="provider" value="articles" />
<param name="max_per_page" value="6" />
<param name="properties" type="collection">
<param name="title" value="title"/>
<param name="excerptTitle" value="excerpt.title"/>
<param name="url" value="url"/>
<param name="description" value="description"/>
<param name="excerptDescription" value="excerpt.description"/>
<param name="uuid" value="object.resource.uuid"/>
<param name="authored" value="object.authored"/>
<param name="image" value="image"/>
<param name="template" value="object.templateKey"/>
</param>
<param name="present_as" type="collection">
<param name="slider">
<meta>
<title lang="en">Slider</title>
</meta>
</param>
</param>
</params>
</property>
When this smart_content is resolved for a twig template the content.description is null even though article has a description filled.
Instead you get this:
"news" => [
[
"excerptTitle" => "Test"
"excerptDescription" => "<p>test</p>"
"uuid" => "01a06650-f727-7d6e-8528-0c199c037959"
"authored" => "2026-09-03T08:09:37+00:00"
"template" => "article"
"title" => "image-name"
"url" => "/media/9/download/image-name.jpg?v=1"
"image" => array:35 [▶]
"description" => null // incorrect null value
"lastModified" => null
]
]
Expected Behavior
All content fields should be filled with correct values.
Example result:
"news" => [
[
"excerptTitle" => "Test"
"excerptDescription" => "<p>test</p>"
"uuid" => "01a06650-f727-7d6e-8528-0c199c037959"
"authored" => "2026-09-03T08:09:37+00:00"
"template" => "article"
"title" => "image-name"
"url" => "/media/9/download/image-name.jpg?v=1"
"image" => array:35 [▶]
"description" => "<p>Something ...</p>" // correct
"lastModified" => null
]
]
Steps to Reproduce
Having the above configuration description will be overwritten by description within image. The error happens in
Sulu\Content\Application\ContentResolver\DataNormalizer\ContentViewDataNormalizer::recursivelyMapProperties()
During recursively mapping properties image is and array and thus stepped in here:
if (\is_array($value) && 'view' !== $key) {
Hovewer because of this line:
public function recursivelyMapProperties(
...
$rootPath = $isRoot ? $rootSegments : ['content', ...$rootSegments];
// @phpstan-ignore-next-line
$this->propertyAccessor->setValue($data, $this->buildPropertyPath($rootPath), $value);
...
$rootPath is incorrectly set to ['content', 'description'] instead of ['content','image','description'] thus overwriting content.description.
Possible Solutions
When you change the order defined in smart_content properties the issue doesn't affect anything but that's a workaround. Ideally $rootSegments should also contain full path, e.g. content.image? I am not brave enough to suggest a fix to this because it's widely used function in Sulu and I don't know what else does it affect.
Actual Behavior
Have a article
smart_contentproperty with configuration like this:When this
smart_contentis resolved for a twig template the content.description is null even though article has a description filled.Instead you get this:
Expected Behavior
All content fields should be filled with correct values.
Example result:
Steps to Reproduce
Having the above configuration description will be overwritten by description within image. The error happens in
Sulu\Content\Application\ContentResolver\DataNormalizer\ContentViewDataNormalizer::recursivelyMapProperties()During recursively mapping properties image is and array and thus stepped in here:
Hovewer because of this line:
$rootPath is incorrectly set to
['content', 'description']instead of['content','image','description']thus overwritingcontent.description.Possible Solutions
When you change the order defined in
smart_contentpropertiesthe issue doesn't affect anything but that's a workaround. Ideally$rootSegmentsshould also contain full path, e.g.content.image? I am not brave enough to suggest a fix to this because it's widely used function in Sulu and I don't know what else does it affect.