Describe your bug or feature request.

Profile::getLabel() normally returns a label that is entity type + entity id. e.g. "Customer information #1".

The Profile Label Subscriber responds to the PROFILE_LABEL event to provide a more meaningful label, the first line of the address, e.g. "123 Main Street".

If, for some reason, the addressline1 is NULL, though, we overwrite the "Customer information #1" with NULL.

This causes a WSOD when $entity->toLink() is called on the entity and the link is rendered. This occurs on the profile list builder, for example.

While having an address without an addressline1 is an edge case, it can happen, for example if a payment gateway is providing the address, but either fails to provide the address line 1, or returns it in an unexpected property.

Better for us to fall back to the generic "Customer information #1", than cause a WSOD.

If a bug, provide steps to reproduce it from a clean install.

Update a profile address to have a NULL addressline1.

View the profile in the profile list builder. (Or, call $profile->toLink()->toString().)

Issue fork commerce-3541746

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

tomtech created an issue. See original summary.

tomtech’s picture

Status: Active » Needs review

This MR adds a check that skips the Event::setLabel() if addressline1 is not populated.

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

  • jsacksick committed 1a6361f0 on 3.x authored by tomtech
    Issue #3541746 by tomtech, jsacksick: Profile Label Subscriber should...
jsacksick’s picture

Status: Needs review » Fixed

I slightly modified the code to return only in case the profile has no addressfield or an empty address line 1 (to get rid of the big nested if).
Thanks for this.

jsacksick’s picture

Committed a buggy change that I fixed just now... (See https://git.drupalcode.org/project/commerce/-/commit/ca0f584a78901563a96...).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.