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.
We're getting this error lately, on a webform using the address field:
Warning: Missing argument 2 for addressfield_default_values(), called in /home/mysite/public_html/sites/all/modules/addressfield_tokens/addressfield_tokens.components.inc on line 120 and defined in addressfield_default_values() (regel 375 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (regel 376 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined index: bundles in _addressfield_country_options_list() (regel 874 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Warning: Invalid argument supplied for foreach() in _addressfield_country_options_list() (regel 874 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (regel 377 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (regel 404 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Warning: Missing argument 2 for addressfield_default_values(), called in /home/mysite/public_html/sites/all/modules/addressfield_tokens/addressfield_tokens.components.inc on line 120 and defined in addressfield_default_values() (regel 375 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (regel 376 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined index: bundles in _addressfield_country_options_list() (regel 874 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Warning: Invalid argument supplied for foreach() in _addressfield_country_options_list() (regel 874 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (regel 377 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (regel 404 van /home/mysite/public_html/sites/all/modules/addressfield/addressfield.module).
As you can see the errors are related to the Addressfield Tokens module as the Address field module, so I'm not sure which one is causing the issue (feel free to move it if deemed appriopriate).
I wish I had more information on this in order ro reproduce it, but unfortuantely we have no idea why it suddenly popped up there (someone reported this to us).
The address fields are gone too, except for the select list to pick a country.
It happens to the currently recommended version as well as to the dev version.
Comment | File | Size | Author |
---|---|---|---|
#13 | missing_argument-2434707-13.patch | 2.74 KB | joel_osc |
#4 | missing_argument-2434707-4.patch | 2.7 KB | joel_osc |
Comments
Comment #1
knalstaaf CreditAttribution: knalstaaf commentedDisabling the Addressfield Tokens module drastically removes these errors (fields remain missing though), only this one persists, after disabling the Addressfield module as well:
Because the address fields weren't cleaned up after disabling the module. (Cleaning them up manually and clearing the cache fixes this.)
Comment #2
knalstaaf CreditAttribution: knalstaaf commentedDon't want to get every possible party involved, but tokens in the e-mail template are using fields of the Webform layout module.
These tokens look like this:
[submission:values:webformlayoutfield_machinename:fieldinlayoutbox_machinename]
This is how the tokens work with WFL, in order to get them printed in the e-mail. So it's not unthinkable that there's a struggle there.
Comment #3
richH CreditAttribution: richH commentedMEGA PROBLEM!!
Just updated addressfield to latest version and now have these errors. Real big mucho problemo here...!
Rch
Comment #4
joel_osc CreditAttribution: joel_osc commentedI think this is a result of addressfield changing its default_values function to bring in $field and $instance - which I don't think we really have since this is a webform component. I have created a patch that just adds a local default_values function and also a new form element to allow the user to select a default country.
Comment #5
joel_osc CreditAttribution: joel_osc commentedComment #6
owenpm3 CreditAttribution: owenpm3 commented#4 fixed the errors and I was able to select the default value for the country. That default was then carried into the webform correctly.
Based on what I've seen in other posts, you'll have to go back and fix any webform that had a previously declared default country as your data was lost with the latest upgrade of the addressfield module.
Comment #7
wylbur CreditAttribution: wylbur commentedApplied the patch to a fresh install of Drupal 7.34 with addressfield and addressfield token module.
The patch in #4 resolved the errors. Marking as RTBC.
Comment #8
scotwith1t+1 The new addressfield module definitely breaks the webform integration and this patch works quite nicely. Thanks!
Comment #9
Eli-TTested patch with #4 with Drupal 7.36, works fine.
Comment #10
Poieo CreditAttribution: Poieo commentedThis does resolve the error and provide a default value which is nice. But, it seems to force a default value. I'm not sure this is ideal in every situation?
Comment #11
Amad Tababa CreditAttribution: Amad Tababa commentedApplied and Tested patch with #4 with Drupal 7.36, works fine.
Comment #12
joel_osc CreditAttribution: joel_osc commented@Poieo is correct, I will need to add the ability to not have a default country.
Comment #13
joel_osc CreditAttribution: joel_osc commentedHere is the same patch except that it also allows the default country not to be set. Please review, thanks!
Comment #14
fonant CreditAttribution: fonant commentedPatch from #13 works nicely here, so I can set the default country per-field.
Comment #15
Sinan Erdem CreditAttribution: Sinan Erdem commentedPatch from #13 works for me. Thanks for that.
Comment #16
victoriachan CreditAttribution: victoriachan commentedPatch from #13 works for me too. Thanks very much.
Comment #18
markie CreditAttribution: markie at Mediacurrent commentedApplied patch #13 and created dev branch / release. Once dev release is available, please open new issues against that.
Comment #20
rparve@symphony3.com CreditAttribution: rparve@symphony3.com as a volunteer and commentedPatch from #13 works for me too. Thanks very much.
Comment #21
aprilr CreditAttribution: aprilr commented#13 Patch worked great! Thanks!
Comment #22
dasginganinjaI see that the patch is now in dev. Is there any sort of roadmap for when the next release of addressfield_tokens will be available?
Comment #23
deanflory CreditAttribution: deanflory as a volunteer commentedIs that dev version going to be revealed on the project page? It currently does not show.
Comment #24
mccrodp CreditAttribution: mccrodp at X-Team for Pantheon commentedYou can get it from the git repo. The branch naming is wrong here if a dev release was intended for the project page. It would need to be a commit on the main 7.x branch.
https://www.drupal.org/node/1559772/git-instructions/7.x-1.x-dev/nonmain...
Comment #25
wOOge CreditAttribution: wOOge commentedPatch #13 works as applied to 7.x-1.5 Dated: 2014-Oct-29
Comment #26
bogdan.negru CreditAttribution: bogdan.negru commentedWhy is this issue marked as fixed if the fix is not included in the latest stable version?
Comment #27
martin.davidson CreditAttribution: martin.davidson commentedSame question as above - the patch works, can it get merged in?