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).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gocreate’s picture

Having a similar warning here after update to latest:

Warning: Missing argument 4 for entity_metadata_user_access() in entity_metadata_user_access() (line 693 of /srv/bindings/.../code/sites/all/modules/entity/modules/callbacks.inc).

Warning: Missing argument 4 for entity_metadata_user_access() in entity_metadata_user_access() (line 693 of /srv/bindings/.../code/sites/all/modules/entity/modules/callbacks.inc).

Warning: Missing argument 4 for entity_metadata_user_access() in entity_metadata_user_access() (line 693 of /srv/bindings/.../code/sites/all/modules/entity/modules/callbacks.inc).
maximpodorov’s picture

I have the same problem. It should be fixed urgently.

maximpodorov’s picture

Looks like this commit produces this bug:
http://drupalcode.org/project/ctools.git/commitdiff/5438b40

maximpodorov’s picture

Yes, reverting this patch solves the problem.

DamienMcKenna’s picture

Status: Active » Closed (duplicate)
Parent issue: » #2160355: Trying to get property of non-object in entity_metadata_user_access()

The 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()

gocreate’s picture

Applied patch referenced in comment #5. The warnings remain:

Warning: Missing argument 4 for entity_metadata_user_access() in entity_metadata_user_access() (line 693 of /srv/bindings/.../code/sites/all/modules/entity/modules/callbacks.inc).
Warning: Missing argument 4 for entity_metadata_user_access() in entity_metadata_user_access() (line 693 of /srv/bindings/.../code/sites/all/modules/entity/modules/callbacks.inc).
Warning: Missing argument 4 for entity_metadata_user_access() in entity_metadata_user_access() (line 693 of /srv/bindings/.../code/sites/all/modules/entity/modules/callbacks.inc).

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.

maximpodorov’s picture

Status: Closed (duplicate) » Active

No, the patch was incorrect: entity_metadata_user_access() requires 4 parameters, and ctools passes only 3. It should pass four parameters in any case.

DamienMcKenna’s picture

Status: Active » Postponed (maintainer needs more info)

But 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.

davidwhthomas’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.46 KB

@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:

  • entity_type is contained in $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...

davidwhthomas’s picture

Title: Warning after update » Warning after update: Warning: Missing argument 4 for entity_metadata_taxonomy_access
DamienMcKenna’s picture

Title: Warning after update: Warning: Missing argument 4 for entity_metadata_taxonomy_access » Warning after update: Missing argument 4 for entity_metadata_taxonomy_access
FileSize
1.47 KB

A small tweak for coding standards compliance (in the original code! For shame!) plus some whitespace improvements.

DamienMcKenna’s picture

Also, I'm sorry for missing the fact that commit #5438b40 included more than just a node_access() call.

gocreate’s picture

Patch in #11 resolved my problem. Thanks very much!

forestgardener’s picture

I 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.

davidwhthomas’s picture

FileSize
1.54 KB

Here's a reroll of my original working patch with whitespace added and a small improvement to the code comments.

Ravenight’s picture

Status: Needs review » Reviewed & tested by the community

Path #15 worked for me. Marking this RTBC.

Train’s picture

Patch #15 also resolved the Commerce 'Warning: Missing argument 3 for commerce_entity_access()...' issue I was having.

xbrianx’s picture

patch 15 worked for me also

japerry’s picture

Status: Reviewed & tested by the community » Fixed

Ahh 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

hideaway’s picture

This patch does not work for me. I still get those warning. I had to additionally apply https://drupal.org/comment/8521379#comment-8521379

japerry’s picture

Thanks for the note, I've applied Eric's patch upstream.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Anybody’s picture

Fixed for me too, now. Is a new stable release planned for the near future? :)

szt’s picture

So the latest dev (2014-Mar-03 ) fix this problem (too).

sierea’s picture

I 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.

rroblik’s picture

Status: Closed (fixed) » Active

Sorry 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 ?

ndeet’s picture

Hi,

the patch #15 works for us as well.

Warning: Missing argument 4 for entity_metadata_taxonomy_access() ...

now gone, thanks! Hope a stable release is comming soon.

Nikro’s picture

Status: Active » Reviewed & tested by the community
mcpuddin’s picture

Status: Reviewed & tested by the community » Fixed

Patch #15 ( which is what comment #28 refers to ) is already rolled in to -dev. Marking back as fixed.

James A’s picture

Thanks 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!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kopeboy’s picture

How 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..

ergophobe’s picture

@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

rszrama’s picture

Just 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?

Anybody’s picture

I agree with rszrama, this bug should soon be fixed with a new stable release, it's a real problem for many live sites sadly :(

Neil C Smith’s picture

And 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

rszrama’s picture

@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?

davidwhthomas’s picture

Status: Closed (fixed) » Needs review
FileSize
967 bytes

Sorry 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.

maximpodorov’s picture

Status: Needs review » Closed (fixed)
Related issues: +#2209775: Undefined index: access callback in ctools_entity_from_field_context()

Your 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.

afoster’s picture

Confirming this bug appeared after a ctools update from 7.1.6 to 7.1.9. Patch in #38 resolved the issue. thx!

andresc75’s picture

#38 resolved the issue in ctools 7.1.9

JKingsnorth’s picture

Maybe post the positive review in the RTBC issue, since this issue is now marked as closed.

sketman’s picture

Patch in #38 works for me too.

James A’s picture

Same 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

meramo’s picture

Status: Closed (fixed) » Needs work

I 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.

DamienMcKenna’s picture

Status: Needs work » Closed (duplicate)

Putting this back to where it was - the other issue also solves this bug so lets leave it there.

maxplus’s picture

Hi,
#38 solves this issue for me, thanks!

douggreen’s picture

I 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.

fehin’s picture

I'm getting this error message too.
Where is the duplicate issue post?

maximpodorov’s picture

DamienMcKenna’s picture