Skip to content

parseChunk does not give precedence to values passed in #12433

Closed
@pixelchutes

Description

@pixelchutes

Summary

When passing an associative array to $modx->parseChunk(), the values parsed in are not given priority processing order, and therefore are not always honored if you have a conflicting, preexisting placeholder set before it.

Step to reproduce

  1. Create a Plugin (OnWebPageInit) that sets a placeholder on each request:

    $modx->setPlaceholder('example', 'ABC' );
  2. Create a Chunk (example) that outputs the placeholder:

    Example: [[+example]]
  3. Create and run a Snippet, invoking parseChunk, but with custom values:

    return $modx->parseChunk( 'example', array( 'example' => 'XYZ' ) );

Observed behavior

Output = Example: ABC

The parseChunk method calls getChunk resulting in the conflicting placeholder being merged first, prior to parsing the array values provided.

Expected behavior

Output = Example: XYZ

Environment

MODX 2.3.4-dev

Metadata

Metadata

Assignees

Labels

area-corebugThe issue in the code or project, which should be addressed.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions