Using token annotation in rules action crash after update to version 4

Created on 20 August 2024, 3 months ago
Updated 21 August 2024, 3 months ago

Since I updated to version 4 of Rules module, my action rules that use token annotation fail.

The error log show : TypeError : Drupal\typed_data\PlaceholderResolver::scan(): Argument #1 ($text) must be of type string, null given, called in ...web/modules/contrib/rules/src/Plugin/RulesDataProcessor/TokenProcessor.php on line 69

For exemple, my action rule was configured to send a system email to an email store in a field of node form so I specify the email value of my action like this in a direct entry mode : {{node.field_email.value}}

Could you resolve this issue please ?
Thanks and let me know for more details.
Regards

πŸ› Bug report
Status

Closed: duplicate

Version

4.0

Component

Rules Core

Created by

πŸ‡«πŸ‡·France dcoppel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dcoppel
  • Status changed to Closed: duplicate 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    There are two open issues for this - please search the issue queue. I'm on my phone right now so searching and finding those references for you is cumbersome.

    Regardless, Rules in 4.0.x is much stricter with datatypes. In this case your {{node.field_email.value}} is NULL, and the token replacement expects this to be a string. That's what the error is telling you.

    Solving the other issues will prevent Rules from displaying an error in this case, but you're still going to be trying to use a NULL token as a string. The solution to that is to configure your field a default string value, even if it's only an empty string. That way the field will always hold data of the correct datatype.

  • πŸ‡«πŸ‡·France dcoppel

    Thanks for your reply.

    I was trying to put a default value like you said and the error is still the same. (in all my test the fields was not NULL)

    I tried with dev version of module but the result is still the same.
    I found a related issue https://www.drupal.org/project/rules/issues/2849810 β†’ where aitala post the same issue the last 3 weeks.

    I'm thinking that there is an issue to process token annotation by rules conditions.
    Thanks for your help.
    Regards

Production build 0.71.5 2024