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.
After upgrade from version 7.13 to version 7.1.x-dev (and 7.14 too) I see many errors on all my page
Warning: Missing argument 4 for entity_metadata_taxonomy_access() in function entity_metadata_taxonomy_access() (string 784 in file /home/.../sites/all/modules/entity/modules/callbacks.inc).
Notice: Undefined variable: entity_type in function entity_metadata_taxonomy_access() (string 785 in file /home/.../sites/all/modules/entity/modules/callbacks.inc).
Warning: Missing argument 4 for entity_metadata_taxonomy_access() in function entity_metadata_taxonomy_access() (string 784 in file /home/.../sites/all/modules/entity/modules/callbacks.inc).
Notice: Undefined variable: entity_type in function entity_metadata_taxonomy_access() (string 785 in file /home/.../sites/all/modules/entity/modules/callbacks.inc).
Warning: Missing argument 4 for entity_metadata_taxonomy_access() in function entity_metadata_taxonomy_access() (string 784 in file /home/.../sites/all/modules/entity/modules/callbacks.inc).
Notice: Undefined variable: entity_type in function entity_metadata_taxonomy_access() (string 785 in file /home/.../sites/all/modules/entity/modules/callbacks.inc).
Comment | File | Size | Author |
---|---|---|---|
#38 | 2195211-38-ctools-access-callback-fix.patch | 967 bytes | davidwhthomas |
#15 | ctools-n2195211-entity-from-field-access-callback-15.patch | 1.54 KB | davidwhthomas |
Comments
Comment #1
gocreate CreditAttribution: gocreate commentedHaving a similar warning here after update to latest:
Comment #2
maximpodorov CreditAttribution: maximpodorov commentedI have the same problem. It should be fixed urgently.
Comment #3
maximpodorov CreditAttribution: maximpodorov commentedLooks like this commit produces this bug:
http://drupalcode.org/project/ctools.git/commitdiff/5438b40
Comment #4
maximpodorov CreditAttribution: maximpodorov commentedYes, reverting this patch solves the problem.
Comment #5
DamienMcKennaThe patch was to fix a security problem and there's nothing wrong with that code in CTools.
Because "entity_metadata_user_access" comes from the Entity API module, the bug is actually in that module: #2160355: Trying to get property of non-object in entity_metadata_user_access()
Comment #6
gocreate CreditAttribution: gocreate commentedApplied patch referenced in comment #5. The warnings remain:
As I'm far from an expert on either module, I can only observe that this problem occurs upon update to CTools 1.4, is not responsive to the patch for Entity, and disappears upon restoring an earlier version of CTools. If the issue is not with CTools, then at least the recent changes to CTools exposed the problem. Even if related to another module, this does not appear to be a duplicate issue to the one referenced in #5.
Comment #7
maximpodorov CreditAttribution: maximpodorov commentedNo, the patch was incorrect: entity_metadata_user_access() requires 4 parameters, and ctools passes only 3. It should pass four parameters in any case.
Comment #8
DamienMcKennaBut CTools doesn't use 'entity_metadata_user_access' anywhere - check the codebase! The patch above just adds a call to node_access() with the correct two arguments. I suspect something else is interfering.
It might be worthwhile installing the Devel module and making it display a full stack trace for all errors, that way we'll at least know what caused this.
Comment #9
davidwhthomas CreditAttribution: davidwhthomas commented@maximpodorov I think you're correct, ctools is now passing an insufficient number of parameters to the entity access callback.
I've attached a patch to pass current logged in user cloned
$account
object and$entity_type
parameter to the entity access callback.Note:
$to_entity
$account
for access check is, for now, based on current logged in user (clonedglobal $user
)@DamienMcKenna, please note:
entity_metadata_user_access
is called indirectly via the'access callback'
from entity_info, added via this function: http://drupalcontrib.org/api/drupal/contributions!entity!entity.module/f...Comment #10
davidwhthomas CreditAttribution: davidwhthomas commentedComment #11
DamienMcKennaA small tweak for coding standards compliance (in the original code! For shame!) plus some whitespace improvements.
Comment #12
DamienMcKennaAlso, I'm sorry for missing the fact that commit #5438b40 included more than just a node_access() call.
Comment #13
gocreate CreditAttribution: gocreate commentedPatch in #11 resolved my problem. Thanks very much!
Comment #14
forestgardener CreditAttribution: forestgardener commentedI can also report that the patch in #11 has successfully fixed the issue I initially reported in 2195729
Running on Ubuntu 12.04 LAMP x64 with php 5.4.
Thank you everyone.
Comment #15
davidwhthomas CreditAttribution: davidwhthomas commentedHere's a reroll of my original working patch with whitespace added and a small improvement to the code comments.
Comment #16
Ravenight CreditAttribution: Ravenight commentedPath #15 worked for me. Marking this RTBC.
Comment #17
Train CreditAttribution: Train commentedPatch #15 also resolved the Commerce 'Warning: Missing argument 3 for commerce_entity_access()...' issue I was having.
Comment #18
xbrianx CreditAttribution: xbrianx commentedpatch 15 worked for me also
Comment #19
japerryAhh yes, DamienMcKenna and davidwhthomas are right on. Sorry for not getting more reviews before release (since it was an SA)
Patch is rolled in. Thanks guys.
http://drupalcode.org/project/ctools.git/commit/c9cf1ef
Comment #20
hideaway CreditAttribution: hideaway commentedThis patch does not work for me. I still get those warning. I had to additionally apply https://drupal.org/comment/8521379#comment-8521379
Comment #21
japerryThanks for the note, I've applied Eric's patch upstream.
Comment #23
AnybodyFixed for me too, now. Is a new stable release planned for the near future? :)
Comment #24
szt CreditAttribution: szt commentedSo the latest dev (2014-Mar-03 ) fix this problem (too).
Comment #25
sierea CreditAttribution: sierea commentedI didn't need a patch. Through trial and error I found,
Before update, certain taxonomy relationships needed to be defined. User[term] field[term] etc
Now they don't. When in taxonomy template most term relationships are just there.
This could lead to redundant metadata as argument 4 is the 'entity' itself ie term. Removing superfluous relationships killed the error.
Comment #26
rroblik CreditAttribution: rroblik commentedSorry but the problem is still here for me (7.x-1.4+6-dev)
(adding context to node view panel, then use it as parameter inside a view)
Maybe I missed something ?
Comment #27
ndeet CreditAttribution: ndeet commentedHi,
the patch #15 works for us as well.
now gone, thanks! Hope a stable release is comming soon.
Comment #28
Nikro CreditAttribution: Nikro commentedThe patch https://www.drupal.org/files/issues/ctools-n2195211-entity-from-field-ac... worked fine.
Comment #29
mcpuddin CreditAttribution: mcpuddin commentedPatch #15 ( which is what comment #28 refers to ) is already rolled in to -dev. Marking back as fixed.
Comment #30
James A CreditAttribution: James A commentedThanks for the above patch #15 which did remove the error messages.
One thing I did find though is it impacted on views I had within my Drupal Commerce product pages by preventing anonymous users from seeing product details, pricing etc. This can be fixed by either changing the permissions under Product -> View any product of any type and enabling it for anonymous users or by patching commerce products as per this link.
Hope this helps!
Comment #32
kopeboy CreditAttribution: kopeboy commentedHow to know when this will be included in a stable release? This is very important, breakes any complex view you may try to make with entity/taxonomy relationships..
Comment #33
ergophobe CreditAttribution: ergophobe commented@kopeboy - CTools maintainers are very conservative about stable releases and commonly occurs only when necessary to fix security issues. So you have to use the dev version until then
See https://www.drupal.org/node/343333/release
Comment #34
rszrama CreditAttribution: rszrama commentedJust chiming in to say I got bit by this issue on a site I rescued. They were using Commerce which has "access callbacks" in entity info arrays that require four arguments. Glad I found this issue, but 9 months on, do we have any sort of timeline on a new minor release of CTools we can depend on?
Comment #35
AnybodyI agree with rszrama, this bug should soon be fixed with a new stable release, it's a real problem for many live sites sadly :(
Comment #36
Neil C Smith CreditAttribution: Neil C Smith commentedAnd I agree with @rszrama and @Anybody!
As a related aside - IMO the issue statuses on DO are not fit for purpose - issues fixed in dev should still be active - I'd like to see Closed (fixed) replaced with Closed (released)! Resisting temptation to mark this Active - 7.x-1.4
Comment #37
rszrama CreditAttribution: rszrama commented@nsigma That's a good idea, actually; would solve part of the problem we have with duplicate issues appearing after the bot closes out Fixed issues. Since we're tying commits to issue numbers on d.o now, we actually have the data to determine if an issue's commit has been worked into a release or not. Wanna propose it in the d.o project issue tracker or want me to?
Comment #38
davidwhthomas CreditAttribution: davidwhthomas as a volunteer commentedSorry to reopen an old issue, but for some reason this bug has regressed.
The issue now reappears in the current version of ctools.
Here's a reroll of the patch for 7.x.1.x
Please review/commit when possible, thanks.
Comment #39
maximpodorov CreditAttribution: maximpodorov commentedYour patch is the same as in #2209775: Undefined index: access callback in ctools_entity_from_field_context() which is RTBC. Unfortunately, the patch is still not accepted. I think new release with urgent fixes should follow.
Comment #40
afoster CreditAttribution: afoster commentedConfirming this bug appeared after a ctools update from 7.1.6 to 7.1.9. Patch in #38 resolved the issue. thx!
Comment #41
andresc75 CreditAttribution: andresc75 commented#38 resolved the issue in ctools 7.1.9
Comment #42
JKingsnorth CreditAttribution: JKingsnorth commentedMaybe post the positive review in the RTBC issue, since this issue is now marked as closed.
Comment #43
sketman CreditAttribution: sketman commentedPatch in #38 works for me too.
Comment #44
James A CreditAttribution: James A commentedSame issue reappeared going from ctools 7.1.7 to 7.1.9. Patch in #38 fixed it for me.
The errors I had were:
Undefined variable: entity_type in commerce_entity_access() (line 978
Warning: Missing argument 3 for commerce_entity_access() in commerce_entity_access() (line 974
Warning: Missing argument 4 for commerce_entity_access() in commerce_entity_access() (line 974
Hope this helps and thanks for the patch
Comment #45
meramo CreditAttribution: meramo at Bright Solutions GmbH commentedI confirm the bug. Happened when updating to ctools to 7.1.9. Patch #38 worked like a charm.
Not sure if we need to proceed in this issue or create a separate one may be? Nevertheless updating the status to bring some attention to it.
Comment #46
DamienMcKennaPutting this back to where it was - the other issue also solves this bug so lets leave it there.
Comment #47
maxplus CreditAttribution: maxplus commentedHi,
#38 solves this issue for me, thanks!
Comment #48
douggreen CreditAttribution: douggreen as a volunteer and at Tag1 Consulting commentedI think that this should be re-opened. The problem isn't limited to entity_metadata_user_access and entity_metadata_taxonomy_access. The problem exists for any generic entity 'access callback' that supports the Entity API arguments as opposed to the core arguments. Adding the extra arguments causes no harm to functions that don't expect them. But not having the arguments causes problems for those that do.
Comment #49
fehin CreditAttribution: fehin commentedI'm getting this error message too.
Where is the duplicate issue post?
Comment #50
maximpodorov CreditAttribution: maximpodorov commentedhttps://www.drupal.org/node/2209775#comment-9939797
Comment #51
DamienMcKenna