Describe your bug or feature request.
WSOD when reassigning an order that has no email address.
The website encountered an unexpected error. Try again later.
TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 433 of core/lib/Drupal/Component/Utility/Html.php).This can happen when the order is assigned to a customer that does not have an email address. It can also happen when reassigning an anonymous order that has not entered checkout yet (email not yet entered).
If a bug, provide steps to reproduce it from a clean install.
Create a cart as an anonymous user.
As an admin go to the cart and click "Reassign order"
Alternatively order assigned to a customer without an email address will work to reproduce the bug. This would be custom code/module that allows for this.
Solution
The order reassign page is trying to render the customer's email address but when it's NULL Html::escape() correctly throws a type error.
The OrderReassignForm form needs to handle a missing email address correctly in both code paths when generating the $current_customer string.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | commerce-3590071-reassign-order-error-3.patch | 808 bytes | khiminrm |
Issue fork commerce-3590071
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 #3
khiminrm commentedCreated patch from the MR
Comment #4
khiminrm commentedComment #5
rhovlandThis fixes orders that are assigned to customers that have no email address but it doesn't fix reassigning orders that are assigned to anonymous without an email. You can reproduce this by trying to reassign an anon order that hasn't gone through checkout yet (email not yet entered)
Comment #6
rhovlandComment #7
rhovlandBack to needs review. Anon order path has been addressed. Tests passing.
Comment #9
jsacksick commentedComment #11
ivnishjsacksick sorry, but looks like an MR is not merged, but issue is "fixed"