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.
In entity_metadata_field_options_list(), we find the following line (modules/callbacks.inc:445):
return (array) module_invoke($field['module'], 'options_list', $field);
According to the API, hook_options_list() has four parameters, however. Now I regularly get error messages like the following:
Warning: Missing argument 2 for taxonomy_options_list() in taxonomy_options_list() (line 1375 of …/modules/taxonomy/taxonomy.module).
Warning: Missing argument 3 for taxonomy_options_list() in taxonomy_options_list() (line 1375 of …/modules/taxonomy/taxonomy.module).
Warning: Missing argument 4 for taxonomy_options_list() in taxonomy_options_list() (line 1375 of …/modules/taxonomy/taxonomy.module).
Comment | File | Size | Author |
---|---|---|---|
#36 | entity_options_list_fix.patch | 1.32 KB | fago |
#25 | 1556192.patch | 1.58 KB | chx |
#22 | stack-trace.txt | 3.71 KB | joelpittet |
#20 | 1556192_0.patch | 1.58 KB | chx |
#16 | Screen Shot 2012-05-04 at 7.38.28 AM.png | 183.27 KB | chrisrikli |
Comments
Comment #1
drunken monkeyAfter a small bit of testing, it seems simply passing
NULL
for all other parameters suffices.Comment #2
jthomasbailey CreditAttribution: jthomasbailey commentedpatch seems to be working, subscribing
Comment #3
joelrotelli CreditAttribution: joelrotelli commentedThis patch works for me. Thanks.
Comment #4
marcoka CreditAttribution: marcoka commentedthomas you are great! i will test the patch.
Comment #5
ethnovode CreditAttribution: ethnovode commentedThe patch solve my notices/warnings, thanks !
Comment #6
marcoka CreditAttribution: marcoka commentedsolved it here too. small and clear patch :)
Comment #7
Damien Tournoud CreditAttribution: Damien Tournoud commentedSorry about that. I specifically asked we don't change the function signature for hook implementations, but apparently that fell through the cracks.
Comment #8
webchickThis was introduced in #1541792: Enable dynamic allowed list values function with additional context. Sorry. :( The stance of chx and dww there are that hook implementations are internal functions that should not be called elsewhere, but i can see why Entity API does this.
Comment #9
dwwIndeed, sorry for the trouble. However, the old function signature made no sense and made life difficult for people trying to use this API for something real (both OG and project_issue at least, probably many others).
Comment #10
webchickSo that will fix it, but seems a sub-optimal fix because it doesn't take advantage of these new contextual variables. Since entity module has to change either way, seems like it's better for it to provide the same context to other modules.
I tried to fix this, but I can't can't figure out a way to trigger the error. Stock D7 + Entity module doesn't do it, and even after adding some Commerce products with List fields, I still can't get it to fire.
Comment #11
chx CreditAttribution: chx commentedThis is, I believe, a better patch. It's still not perfect -- the views include calls this w/o any sensible context but what can one do. And I can't figure out either how to call this.
Comment #12
chx CreditAttribution: chx commentedLess debug.
Comment #13
nicksanta CreditAttribution: nicksanta commentedPatch from #12 has stopped the errors appearing for me.
Comment #14
nicksanta CreditAttribution: nicksanta commentedActually, after applying the patch from #12 and clearing caches it's created a fatal php issue.
I can't find any mention of that getType() method in the entity module's directory.
Comment #15
chrisrikli CreditAttribution: chrisrikli commentedNick (and chx and webchick), I had to look at the abstract superclass to find what I think are the proper methods. Ended up with this:
return (array) module_invoke($field['module'], 'options_list', $field, NULL, $entity ? $entity->type() : NULL, $entity ? $entity->value() : NULL);
I'm testing it right now, but so far so good.
Comment #16
chrisrikli CreditAttribution: chrisrikli commentedwebchick, here's a shot of my stack trace. Dunno if it will help.
Comment #17
tvilms CreditAttribution: tvilms commentedI see what Nick sees (#14). WSOD after clearing cache.
PHP Fatal error: Call to undefined method EntityValueWrapper::getType() in
.../sites/all/modules/entity/modules/callbacks.inc on line 447
Cleared cache a few more times and now I'm about to proceed with 7.14.
Comment #18
noslokire CreditAttribution: noslokire commentedI was scared to do #12 after reading 13-17, but no problems with #12 for me.
**until 10 minutes later when I enabled the next module and poof WSOD, drush complained about the last line of the patch in #12 when trying to disable the module, so I reverted that line only, site came back from the land of white, re-applied the patch, and errors went away again.
Something to do with enabling or cc like #17 says, although I did clear cache without event.
Comment #19
tvilms CreditAttribution: tvilms commentedSince my post #17, I tried proceeding. When I installed another module, I got the WSOD. I didn't try reverting only the last line of the patch, though, as suggested in #18. Instead, I rolled back to D7.12. Decided to skip the D7.14 update for now. There are a lot of issues possibly coming from other modules. Is very hard to tell what patch does/doesn't fix the errors at this early stage since the D7.14 release.
Comment #20
chx CreditAttribution: chx commentedComment #21
bago CreditAttribution: bago commentedApplied #20 and warnings disappeared.
Comment #22
joelpittetThis may be compounding the issue but patch #20 threw this error after applying:
Call to undefined method EntityListWrapper::data()
And the stacktrace is pointing to Search API. I have attached the stacktrace for reference.
Drupal 7.14 upgrade with this option list warnings it created to any module hooking into it.
http://drupal.org/node/1541792
Comment #23
blackclover CreditAttribution: blackclover commentedsubscribed
Comment #24
chrisrikli CreditAttribution: chrisrikli commentedTry $entity->value() in place of $entity->data().
It's in the abstract superclass EntityMetadataWrapper that EntityListWrapper inherits, line 81
Comment #25
chx CreditAttribution: chx commentedComment #26
nicksanta CreditAttribution: nicksanta commentedPatch from #25 + a cache clear produces the following error for me:
Comment #27
nicksanta CreditAttribution: nicksanta commentedFollowing up from comment #26, a var_dump of $this just before that exception is thrown shows that $this->data = NULL, and thus $this->dataAvailable() returns FALSE.
Comment #28
bago CreditAttribution: bago commentedSame here.. clearing caches breaks everything. Tried #25 and is broken too. Same exception found by #26.
Comment #29
chx CreditAttribution: chx commentedYou can always use #1. This might need actual Entity API maintainers to properly fix.
Comment #30
joelpittetI am going with #1 for now to keep things functioning, was getting the same as #26
Comment #31
Oceanman CreditAttribution: Oceanman commentedThe patch in #1 works for me.
I have followed many threads to get here and see that many talented people are working on this but no one has explained how they get the errors so others can recreate them.
I am not sure if this is how you go about solving these issues but I hope this will help anyone trying to recreate this problem, here is how I get the error:
I think these are the relevant modules (I am using) while getting these errors.
The errors only appear on one of my rules. This rule has 2 data comparisons and 2 negated Data value is empty. Here is the list of rules:
The list of Values for field-profile-state are visible, hidden, incomplete
Here are my errors:
Comment #32
FranckV CreditAttribution: FranckV commented#1 works perfectly for me
Comment #33
klausiThis can really flood your logs, updating priority.
Comment #34
serkuz CreditAttribution: serkuz commentedThanks, #1 sold the problem. Just to remind that if you upgrading the Entity API to latest release (which I did bevore applying the patch) - you need to upgrade i18n as well to 1.5! Otherwise after "clearing the cache" everything just stops working. No error messages, no warnings, no logs...
Comment #35
khiminrm CreditAttribution: khiminrm commented#1 works for me
Comment #36
fagoI took a stab on that, patch attached. please test.
Comment #37
stevebab CreditAttribution: stevebab commentedFago -- tested your patch and it worked great -- errors are cleared up. Thank you.
Comment #38
joelpittet@fago same here tested the patch and no issues, errors were caught. Thank you
Comment #39
tim.plunkettYep, this looks right to me.
Comment #40
bago CreditAttribution: bago commented#36 works here, too. Thank you.
Comment #41
fagothanks, committed.
Comment #42
hass CreditAttribution: hass commentedHow about rc3? :-)
Comment #43
tregismoreira CreditAttribution: tregismoreira commented#1 works for me too
Comment #44
bago CreditAttribution: bago commented@tregismoreira: please note that #1 is not a fix, but a temporary workaround. It simply pass "null" to avoid the warning, but it will break as soon as someone will start using the parameters and will find null. Please test #36, instead, as it is the patch that will be released.
Comment #45
bago CreditAttribution: bago commentedSorry, I changed the status by mistake... reverting.
Comment #46
vmd111 CreditAttribution: vmd111 commented#36 works for me, too. Thank you.
Comment #47
IWasBornToWin CreditAttribution: IWasBornToWin commentedsame here, #36 a success....thanks!
Comment #48.0
(not verified) CreditAttribution: commentedTypo