Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
A WSOD is shown when a system.mail action is triggered, containing invalid/not available tokens in the mail message body.
Casus: send an notification mail when a new comment is posted.
Steps to reproduce:
- Add new rule "rules_entity_insert:comment" (After saving new comment)
- no conditions per se
- add action "system > send email"
- add a token thats not available like "{{site.url}}" to the message body field
- trigger the action by submitting a comment
Comment | File | Size | Author |
---|---|---|---|
#6 | 2817683-wsod-invalid-tokens-get.patch | 672 bytes | swim |
Comments
Comment #2
swim CreditAttribution: swim commentedPlease see, https://github.com/fago/rules/pull/487; as a potential solution.
Comment #3
swim CreditAttribution: swim commentedComment #4
TR CreditAttribution: TR commentedI can confirm that following the above steps leads to a WSOD.
Moving to "Active" status as there is no patch to review yet.
Comment #5
TR CreditAttribution: TR commentedI closed #2862768: [comment:edit-url] : Undefined Variable, which was reporting the same error with the invalid (D7-style tokens) [site:mail], [comment:body], and [comment:edit-url]
Comment #6
swim CreditAttribution: swim commentedSorry I thought all dev work was happening on github :S, please find attached.
Comment #7
fagoTest seems to fail? Anyway, I think we should add a test case to proof this works now even with invalid tokens.
Comment #8
TR CreditAttribution: TR commentedThese are real test failures - that is, the patch changed the message Rules outputs when there is an invalid token, and the test is still looking for the 'old' message.
Personally, I think the 'old' message, which is
Data selector <em class="placeholder">list_item</em> for context <em class="placeholder">Text to concatenate</em> is invalid. Unable to get variable list_item, it is not defined.
is a LOT more descriptive and useful than the new message after the patch, which isUndefined index: list_item
.Regardless, the module output has to match what the string is testing for. The test failure happens in
Drupal\Tests\rules\Unit\Integration\Engine\LoopTest::testOutOfScopeVariableExecution()