Replacing null value with empty default! warning
Hello,
We have similar code in few templates; we get a warning "Replacing null value with empty default!" for the same, code is as below
the related code for st_accordion_list in form is as below
<FS_CATALOG name="st_accordion_list" useLanguages="yes">
<LANGINFOS>
<LANGINFO lang="*" label="Accordion-Section" description="Please insert your accordion-section here."/>
<LANGINFO lang="DE" label="Accordion-Section" description="Bitte fügen Sie hier Ihre Accordion-Section ein."/>
</LANGINFOS>
<TEMPLATES type="section">
<TEMPLATE uid="st_accordion_item_html"/>
</TEMPLATES>
</FS_CATALOG>
-
Hello Sumant,
the code you posted shouldn’t generate that warning message. The warning message indicates that a variable has the value zero and therefore cannot be output correctly. Your code uses variables in three places:
$CMS_VALUE(grid, default:"")$ => by using ,default:"" you bypass the Warning
$CMS_FOR(section, st_accordion_list)$ => if st_accordion_list is null, you would get an ERROR (cannot iterate...)
$CMS_VALUE(section)$ => This variable is defined within the CMS_FOR, so it has a valid value.
I assume, that within the section templated used within the FS_CATALOG an input component has no value and triggers the warning.
Try the following to find the root cause of the WARN message:
* open the SiteArchitect
* navigate to the appropriate page (or pageref)
* open the context menue and select "Display preview errors" and the appropriate language and output channelYou should get a popup with the Warning. Click on the last line of the stacktrace and you will be taken to the relevant line of the template.
Here is an explanation of the warning’s stack trace, using an example
23.03.2026 08:13:46.246 WARN ($CMS_VALUE(st_accordion_list)$ at 19, 1): Replacing null value with empty default! Undefined variable 'st_accordion_list'!
inside of: PageTemplate 'standardpage' (id=2342822) (channel=html)
inside of: $CMS_TRIM(level:3, char:\n)$ - at 124, 56
inside of: $CMS_VALUE(#global.page.body("body"))$ - at 238, 4
inside of: SectionTemplate 'download' (id=2342871) (channel=0)
inside of: $CMS_VALUE(st_accordion_list)$ - at 19, 1The Warning occurs on the PageTemplate with the UID standardpage (and the id 2342822) within the output channel "html".
There within a $CMS_TRIM()$ tag (in line 124 at position 56)
And within the CMS_TRIM a CMS_VALUE is used in line 238.
This CMS_VALUE triggers the output of the section template 'download'
And within this section template in line 19 the tag $CMS_VALUE(st_accordion_list)$ triggers the warning.
In this case the variable "st_accordion_list" is null.Best regards
Holger0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire