TypeError: Drupal\commerce_email\EmailSender::replaceTokens(): Argument #1 ($value) must be of type string, null given, called in /var/www/drupal10/web/modules/contrib/commerce_email/src/EmailSender.php on line 111 in Drupal\commerce_email\EmailSender->replaceTokens() (line 158 of /var/www/drupal10/web/modules/contrib/commerce_email/src/EmailSender.php).
Steps to reproduce
Not sure, but presumably send an email with a null value returned from $email->getReplyTo().
Proposed resolution
Allow null|string argument, or cast the null to an empty string before calling replaceTokens()?
Issue fork commerce_email-3420018
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fonant commentedI've hacked a workaround for line 111 of commerce_email/src/EmailSender.php, which I think will fix the problem:
Maybe we need an update function to add empty ReplyTo strings for older orders?
Comment #3
fonant commentedDoh! Of course the other way to fix this is to edit each email definition at /admin/commerce/config/emails and just re-save each one.
Comment #6
chetan 11 commentedPlease check the above MR.
Comment #8
vmarchukYeah, I just reproduced it too. In the getReplyTo() method we need to use the default value and that's it.
MR updated with fixes.
Comment #9
jsacksick commentedI think the right fix would be to change the code from:
to:
Comment #10
vmarchukCommitted!