-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.0.2] Fix parsing modifiers when encountering literal brackets #16302
Conversation
2b1ba75
to
813b090
Compare
@Mark-H Can you also add a test for
because we get this error log
To be honest this is our fix after the 3.0.2 release. We had to simplify it. Before we had this kind of code
|
That tag isn't valid; the inner uncached tag will always be processed later than the outer cached tag, leading to that error. It'll still "work" because the cached tag does get processed later on when the uncached tag is also parsed, but it is wrong. You'll need to uncache the outer tag too to make it correct:
|
Corrected our wrong code. |
This pull request has been mentioned on MODX Community. There might be relevant details there: https://community.modx.com/t/a-colon-in-a-resources-content-is-breaking-a-template/6127/4 |
@Mark-H - I've been working on testing this and wanted to be clear on a couple things before submitting a review:
Test Resource (where the cases are placed):
Test Chunk (body--test-pr-16302)
Test Template (Test 16302)
|
This pull request has been mentioned on MODX Community. There might be relevant details there: https://community.modx.com/t/modx-3-02-input-output-filters/6242/2 |
Hmm, 2a is interesting, not immediately seeing the cause for that. Putting a space between the end of the tag and the random brackets does help: The other case seems to be due to the uncached placeholders in a cached chunk. The chunk will get parsed, the uncached placeholders left alone, and then when the uncached gets processed those values no longer exist. |
This pull request has been mentioned on MODX Community. There might be relevant details there: https://community.modx.com/t/modx3-broken-output-filter-modifiers/5906/13 |
I think the error happens on this line in the modParser: revolution/core/src/Revolution/modParser.php Line 150 in ad6977d
This seems to be a separate issue and unrelated to this PR. |
This pull request has been mentioned on MODX Community. There might be relevant details there: https://community.modx.com/t/modx-3-0-3-and-seo-suite-3-1-1-rc4/6295/2 |
This pull request has been mentioned on MODX Community. There might be relevant details there: https://community.modx.com/t/content-block-conditional-render-nested-is-1-then-not-working/6321/2 |
We have this situation
but it just render this parts below as a text
|
Try also applying #16316. |
And if there are still issues please open a new issue |
This pull request has been mentioned on MODX Community. There might be relevant details there: https://community.modx.com/t/output-modifiers-issue-on-modx-3-0-3/6405/2 |
This pull request has been mentioned on MODX Community. There might be relevant details there: https://community.modx.com/t/problems-after-update-to-modx-3/6429/2 |
This pull request has been mentioned on MODX Community. There might be relevant details there: https://community.modx.com/t/pthumb-filtering-with-php8/6431/4 |
What does it do?
Fix where literal brackets (not intended as an opening/closing tag) go in the parsed command modifiers.
Why is it needed?
John MacDonald reported the parser breaking in the following scenario:
Rather than outputting the script, it returned just the value of
[[++google_analytics]]
.That test case was simplified to
[[+tag:notempty=`[]`]]
as the literal brackets appeared to be the problem.Internally, the command ended up as
notempty[]
with an empty modifier. Thenotempty[]
command doesn't exist so the original value is returned in its place.By using the
$inModifier
flag (which gets set in the switch case for`
when depth is 0) the brackets are parsed into the modifiers as they should.How to test
See tests for examples. Feel free to come up with more complex cases.
Related issue(s)/PR(s)
Reported via Slack.
Introduced with #16288 in 3.0.2.