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
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
tomtech commentedThis MR adds a check that skips the Event::setLabel() if addressline1 is not populated.
Comment #6
jsacksick commentedI 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.
Comment #7
jsacksick commentedCommitted a buggy change that I fixed just now... (See https://git.drupalcode.org/project/commerce/-/commit/ca0f584a78901563a96...).