Skip to content

Parser issue with nested elements #13043

Open
@christianseel

Description

@christianseel

Summary

There seems to be a bug in the MODX parser with a special nested MODX tag structure. Issue exists if you have nested chunk calls where the chunk name contains another placeholder like [[$chunk-[[*context_key]]]].

Step to reproduce

  • create a chunk called chunk-1 and paste the following content:
<div class="wrapper">
    <span>Level: [[+level:default=`not set`]]</span>
    [[+nestedcontent]]
</div>
  • edit the resource with the ID 1 (can be any other resource but then update the name of the chunk with the resource ID)
  • fill the following code into the content field:
[[$chunk-[[*id]]?
        &level=`1`
        &nestedcontent=`
            [[$chunk-[[*id]]?
                &level=`2`
                &nestedcontent=`
                    [[$chunk-[[*id]]?
                        &level=`3`
                        &nestedcontent=`
                            this is level 3. and here it breaks!
                        `
                    ]]
                `
            ]]
        `
    ]]

Observed behavior

MODX parser breaks at the 3rd level and returns wired output with broken placeholder/tags like

<div class="wrapper">
<span>Level: 1</span>
`
            [[$chunk-1?
                &level=`2`
                &nestedcontent=`
                    [[$chunk-1
</div>

</div>

If you remove the most inner chunk call (3rd level) and just leave the other 2 levels it works as expected.

Also if you replace the [[*id]] placeholder in the chunk name with 1 it works as expected.

Expected behavior

Correct output with 3 <div class="wrapper"> and a text this is level 3. and here it breaks! in the inner div.

Environment

Tested with MODX 2.5.0-pl and 2.4.2-pl. Also PHP 5.6 and 7.0. Both Apache.
No special templates, no ContentBlocks…

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-corebugThe issue in the code or project, which should be addressed.urgentThe issue requires attention and has higher priority over others.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions