Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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'.
Comment | File | Size | Author |
---|---|---|---|
#1 | addressfield-undefined_index_country-2397427-1.patch | 779 bytes | pachabhaiya |
Comments
Comment #1
pachabhaiya CreditAttribution: pachabhaiya commentedAdded a patch for just a quick fix for this issue.
Comment #2
bojanz CreditAttribution: bojanz commentedWhich plugins do you have enabled for your field? (Address, organization, etc).
Is the field required?
Which entity type is it attached to?
Comment #3
pachabhaiya CreditAttribution: pachabhaiya commented@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
Comment #4
bojanz CreditAttribution: bojanz commentedNo information provided for reproducing the bug.
If it reappears, update to -dev first, then retest.
Comment #5
Dom. CreditAttribution: Dom. as a volunteer and at ACINO commentedHi 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 ?