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.
Error outputed upon saving the form of a send mail action: InvalidArgumentException: Cannot set a list with a non-array value. in Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue() (line 59 of core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php).
Steps to reproduce the bug:
- Create a fresh Drupal 8 install
- Enable the rules module
- Navigate to rule configuration page
- Add a new rule
- Configure a reaction to: After saving new comment (rules_entity_insert:comment)
- Add an action
- Select Send email
- Configure the action
- Save the action
- Observe error
This can be reproduced on https://simplytest.me/ website and on a local environment.
Comments
Comment #2
roaldumandal CreditAttribution: roaldumandal commentedI can confirm this, its also happening to me, I also tried to add conditions and I am getting this same error message
Comment #3
jelhan CreditAttribution: jelhan commentedSeems to be fixed on current dev (bff3e8d26603def181aaae1cbf059db629b7ed25).
Comment #4
jelhan CreditAttribution: jelhan commentedThere is another issue still present in dev. If you create a rule containing send mail action it throws on saving the rule (not the action):InvalidArgumentException: The configuration property expression.actions.actions.0.context_values.to.0 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
Having "test@examples.com" as to and just plain strings as subject and message.Tested again on clean environment and can't reproduce. I guess I messed up cache while switching versions.
Comment #5
vasyl.kletsko CreditAttribution: vasyl.kletsko commentedI have the same bug in 8.x-3.0-dev version
Comment #6
mgadrat CreditAttribution: mgadrat commentedI tried to reproduce the bug using the steps I documented in this issue and I did not observe the error.
I tested with 8.x-3.0-alpah2 on https://simplytest.me
I consider it fixed.
vasil kletsko can you try to reproduce the bug and then post your steps?
Comment #7
toddwoof CreditAttribution: toddwoof commentedIn case this is useful to someone: I also couldn't save a send email action. Tried uninstalling, etc. It turns out I initially did something wrong in adding the send email action, and the resulting broken rule doesn't get removed by deleting it. That is, if you delete the rule and create a new one with the same machine name, you will still have a broken rule. Making a new rule with a different machine name worked.
Comment #8
varsharani CreditAttribution: varsharani commentedWhat should I select in "E-mail type" of event type "Send account e-mail"?
Comment #9
DamienMcKennaHas anyone tested this with alpha3?
Comment #10
TR CreditAttribution: TR commentedYes, I have, and it works for me (see my comment in #2827183-14: System: Send email action fails if $to is a string). But I'm using -dev, not alpha3 ...
I don't think we're all necessarily testing the same thing. Note that when I test, I enter an actual e-mail address in the To: field, and that's what works. But some other reports use the data selector to grab an e-mail value from somewhere, and it's this value that generates the error about converting an array to a string.
As far as the current issue, the instructions to reproduce in the original post simply say "Configure the action" so I have no idea what is being used for the To: value.
There are a number of open issues that all touch on this e-mail problem with the "non-array value" error.
https://www.drupal.org/project/issues/rules?text=email%20array&status=Op...
@fago's comment in #2827183-10: System: Send email action fails if $to is a string implies this is all a side-effect of a bigger issue.
Comment #11
TR CreditAttribution: TR commentedThis will be addressed by #2723259: Allow single-valued data selector input to be passed as an array for 'multiple' context fields