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.

Issue fork commerce-3590071

Command icon 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

khiminrm created an issue. See original summary.

khiminrm’s picture

StatusFileSize
new808 bytes

Created patch from the MR

khiminrm’s picture

Status: Active » Needs review
rhovland’s picture

Title: Error or the Reassign order when an order's email is NULL » Error on the Reassign order page when an order's email is NULL
Status: Needs review » Needs work

This 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)

rhovland’s picture

Issue summary: View changes
rhovland’s picture

Status: Needs work » Needs review

Back to needs review. Anon order path has been addressed. Tests passing.

jsacksick made their first commit to this issue’s fork.

jsacksick’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

ivnish’s picture

jsacksick sorry, but looks like an MR is not merged, but issue is "fixed"

  • jsacksick committed 613e5029 on 3.x authored by khiminrm
    fix: #3590071 Error on the Reassign order page when an order's email is...