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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

keesje created an issue. See original summary.

swim’s picture

Please see, https://github.com/fago/rules/pull/487; as a potential solution.

swim’s picture

Status: Active » Needs review
TR’s picture

Status: Needs review » Active

I can confirm that following the above steps leads to a WSOD.

Moving to "Active" status as there is no patch to review yet.

TR’s picture

I 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]

swim’s picture

Sorry I thought all dev work was happening on github :S, please find attached.

fago’s picture

Status: Needs review » Needs work

Test seems to fail? Anyway, I think we should add a test case to proof this works now even with invalid tokens.

TR’s picture

These 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 is Undefined 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()