$context['mode'] is required to be 'form' or 'render' when calling addressfield_generate() which in-turn calls addressfield_format_address_generate() with the same requirement. This causes undefined index errors.

$context['mode'] needs to either be checked before a comparison or $context array needs to be changed to a required argument.

Related to

Members fund testing for the Drupal project. Drupal Association Learn more


andyg5000’s picture

Patches for either solution preferred attached

rooby’s picture

SocialNicheGuru’s picture

error in 1678800-require_context_array.patch

PHP Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ',' or ')' in /var/aegir/platforms/7/modules/all/addressfield/addressfield.module on line 127

hass’s picture

Status: Active » Needs work
rszrama’s picture

Status: Needs work » Fixed

Good find, Andy. It looks like the intent of the function was to default to 'render' if a valid mode wasn't given. Since I'm hesitant to change the function signature without really knowing how many other modules that might break, I'm just going to update the docs for the function and initialize the mode in the context array if it isn't present. I've also made the if ... else statement explicitly check for the 'render' mode.


Status: Fixed » Closed (fixed)

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