I'm getting a bunch of these watchdog notices:

Notice: Undefined index: country in addressfield_format_address_generate() (line 224 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 213 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 213 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 209 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 198 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 194 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 191 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 186 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 183 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 156 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 151 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 145 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 64 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).
Notice: Undefined index: country in addressfield_format_address_generate() (line 27 of /var/www/sites/all/modules/contrib/addressfield/plugins/format/address.inc).

When I do dpm($address) inside addressfield_format_address_generate() function, it only outputs the values for indexes 'first_name' and 'last_name'.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pachabhaiya’s picture

Added a patch for just a quick fix for this issue.

bojanz’s picture

Which plugins do you have enabled for your field? (Address, organization, etc).
Is the field required?
Which entity type is it attached to?

pachabhaiya’s picture

@bojanz
I found another solution for this issue. I don't need the patch for this.

What the problem was ?
--------------------
I'm using addressfield module together with the commerce module.

I have a page created using views to display a report of subscribers including their billing address.
In the Views, field used to display the billing address = "(Billing) Commerce Customer profile: Address"

I was using addressfield-7.x-1.0-beta4 initially. I got lots of watchdog errors related to "country, thoroughfar, premise, postal_code, locality" when accessing the views page.
After updating the module to addressfield-7.x-1.0-rc1, all other errors were resolved except 'country' field.

How I solved ?
------------
After updating the address field module from 7.x-1.0-beta4 to 7.x-1.0-rc1, I deleted the views field "(Billing) Commerce Customer profile: Address" and recreated it.
The watchdog errors mentioned in this issue is also resolved after recreating the views field (related to address field).

@bojanz
Please let me know if there is any better solution for this.

Thanks

bojanz’s picture

Status: Active » Closed (cannot reproduce)

No information provided for reproducing the bug.

If it reappears, update to -dev first, then retest.

Dom.’s picture

Status: Closed (cannot reproduce) » Needs review

Hi there!
I also have this problem and I can reproduce it.
The point is I try to override addressfield_token module (see #2701447: Missing country index when returning to the field in a multistep form).
Therefore, the patch #1 (https://www.drupal.org/node/2397427#comment-9456369) is exactly what I came up with to solve the issue.
It is not technically needed for addressfield module but would be great help for modules around.
Would you consider adding ? Or that it takes some more work for you ?