Problem:
$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.

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

Related to http://drupal.org/node/1664378

Comments

Patches for either solution preferred attached

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

Status:Active» Needs work

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.

Commit: http://drupalcode.org/project/addressfield.git/commitdiff/fc2ef44

Status:Fixed» Closed (fixed)

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