After I upgraded OG from 7.1.1 to 7.1.2 I get this error when I try to clear my cache.

WD menu: EntityMalformedException: Missing bundle property on entity of type node. in [error]
entity_extract_ids() (line 7405 of
/var/www/***/includes/common.inc).

Any suggestions how to fix this?

Comments

medden’s picture

In case anyone else gets this. I solved the error by disabling the og_field_access module, which I didn't really need anyway.

amitaibu’s picture

Status: Active » Postponed (maintainer needs more info)
  • Did you run update.php?
  • Do you have latest entity API?
jdlind38’s picture

I also experienced this error and disabled the og_field_access module before I performed the update to 7.1.2. I also have the Field Permissions module (7.x-1.0-beta1) installed, could there be a conflict?

medden’s picture

I do have latest entity API and I did run update.php and clear caches.

The error comes back if I re-enable og_field_access module- so I'm guessing it's something in there causing the error.

amitaibu’s picture

Status: Postponed (maintainer needs more info) » Active

I'm trying to reproduce, but can't see so far the problem. Can anyone share the steps to reproduce?

ishadakota’s picture

I can't give more information about how to reproduce, but I also had the same issues and the error was occurring under these conditions.

  • For anonymous users only (actually I can only verify that it was for non-admin users)
  • Only on pages that incorporated a View (can only verify that it occurred on view pages, not sure about blocks or content panes)
  • Disabling the field access module fixed the issue, although I have no idea why - I was beginning to search the Views issues queue, but stumbled upon this first.

I'll test some more later to see if I can reproduce and be more specific.

amitaibu’s picture

Can anyone attach here a db dump of your dev. Make sure to disable everything that is not necessary, so it's easy to test it.

othermachines’s picture

Priority: Normal » Critical

Exact same problem here (#6). Updating to critical since anonymous users can't access my site at all.

There seems to be a problem with the implementation of the new $strict argument in og_user_access_entity() (commit d0a49411 Accessing an entity should be less permissive). When an unset $entity is passed into this function from og_field_access_field_access() the error is triggered in entity_extract_ids() before the value of $strict is processed.

To clarify, if we replace the old lines (from 7.x-1.1)...

function og_user_access_entity($perm, $entity_type, $entity, $account = NULL, $strict = TRUE) {
  // Make sure entity is a group or group content.
  if (!isset($entity->{OG_AUDIENCE_FIELD}) && !isset($entity->{OG_GROUP_FIELD})) {
    return;
  }
...

.. the error goes away.

Hope that helps.

amitaibu’s picture

Priority: Critical » Normal

> When an unset $entity is passed into this function from og_field_access_field_access()

When do you get an unset $entity - hook_field_access() should get a populated entity.

amitaibu’s picture

Priority: Normal » Critical

re-Setting priority

andrés chandía’s picture

Priority: Critical » Normal

Same problem, I enable the og_field_access module, and do log out, I get this:
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7405 of .../includes/common.inc). I have Entity API 7.x-1.0-beta11

I'm also experiencing the problem described here: http://drupal.org/node/1321028

othermachines’s picture

Correction: Only superadmin doesn't get the error, which makes sense because of the check for $user->uid == 1 at the top of og_user_access_entity().

$entity is an optional argument in hook_field_access, is it not?

Here's a snippet of my backtrace, if it helps:


#0  og_field_access_field_access(view, Array ([translatable] => 1,[entity_types] => Array (),[settings] => Array ([uri_scheme] => public,[default_image] => 40),[storage] => Array ([type] => field_sql_storage,[settings] => Array (),[module] => field_sql_storage,[active] => 1,[details] => Array ([sql] => Array ([FIELD_LOAD_CURRENT] => Array ([field_data_field_slider_image] => Array ([fid] => field_slider_image_fid,[alt] => field_slider_image_alt,[title] => field_slider_image_title)),[FIELD_LOAD_REVISION] => Array ([field_revision_field_slider_image] => Array ([fid] => field_slider_image_fid,[alt] => field_slider_image_alt,[title] => field_slider_image_title))))),[foreign keys] => Array ([fid] => Array ([table] => file_managed,[columns] => Array ([fid] => fid))),[indexes] => Array ([fid] => Array ([0] => fid)),[id] => 27,[field_name] => field_slider_image,[type] => image,[module] => image,[active] => 1,[locked] => 0,[cardinality] => 1,[deleted] => 0,[columns] => Array ([fid] => Array ([description] => The {file_managed}.fid being referenced in this field.,[type] => int,[not null] => ,[unsigned] => 1),[alt] => Array ([description] => Alternative image text, for the image's 'alt' attribute.,[type] => varchar,[length] => 128,[not null] => ),[title] => Array ([description] => Image title text, for the image's 'title' attribute.,[type] => varchar,[length] => 128,[not null] => )),[bundles] => Array ([node] => Array ([0] => featured_slider))), node, , stdClass Object ([uid] => 0,[hostname] => 127.0.0.1,[roles] => Array ([1] => anonymous user),[cache] => 0)) called at [C:\wamp\www\c4d\modules\field\field.module:1018]
#1  field_access(view, Array ([translatable] => 1,[entity_types] => Array (),[settings] => Array ([uri_scheme] => public,[default_image] => 40),[storage] => Array ([type] => field_sql_storage,[settings] => Array (),[module] => field_sql_storage,[active] => 1,[details] => Array ([sql] => Array ([FIELD_LOAD_CURRENT] => Array ([field_data_field_slider_image] => Array ([fid] => field_slider_image_fid,[alt] => field_slider_image_alt,[title] => field_slider_image_title)),[FIELD_LOAD_REVISION] => Array ([field_revision_field_slider_image] => Array ([fid] => field_slider_image_fid,[alt] => field_slider_image_alt,[title] => field_slider_image_title))))),[foreign keys] => Array ([fid] => Array ([table] => file_managed,[columns] => Array ([fid] => fid))),[indexes] => Array ([fid] => Array ([0] => fid)),[id] => 27,[field_name] => field_slider_image,[type] => image,[module] => image,[active] => 1,[locked] => 0,[cardinality] => 1,[deleted] => 0,[columns] => Array ([fid] => Array ([description] => The {file_managed}.fid being referenced in this field.,[type] => int,[not null] => ,[unsigned] => 1),[alt] => Array ([description] => Alternative image text, for the image's 'alt' attribute.,[type] => varchar,[length] => 128,[not null] => ),[title] => Array ([description] => Image title text, for the image's 'title' attribute.,[type] => varchar,[length] => 128,[not null] => )),[bundles] => Array ([node] => Array ([0] => featured_slider))), node) called at [C:\wamp\www\c4d\profiles\buildkit\modules\contrib\views\modules\field\views_handler_field_field.inc:73]
#2  views_handler_field_field->access() called at [C:\wamp\www\c4d\profiles\buildkit\modules\contrib\views\includes\view.inc:586]
#3  view->_init_handler(field, Array ([title] => Fields,[ltitle] => fields,[stitle] => Field,[lstitle] => field,[plural] => fields)) called at [C:\wamp\www\c4d\profiles\buildkit\modules\contrib\views\includes\view.inc:494]
#4  view->init_handlers() called at [C:\wamp\www\c4d\profiles\buildkit\modules\contrib\views\plugins\views_plugin_display.inc:2339]
#5  views_plugin_display->pre_execute() called at [C:\wamp\www\c4d\profiles\buildkit\modules\contrib\views\includes\view.inc:1133]
#6  view->pre_execute(Array ()) called at [C:\wamp\www\c4d\profiles\buildkit\modules\contrib\views\includes\view.inc:1101]
#7  view->preview() called at [C:\wamp\www\c4d\profiles\buildkit\modules\contrib\ctools\views_content\plugins\content_types\views.inc:207]

The field that's being checked:

Array
(
    [translatable] => 1
    [entity_types] => Array
        (
        )

    [settings] => Array
        (
            [uri_scheme] => public
            [default_image] => 40
        )

    [storage] => Array
        (
            [type] => field_sql_storage
            [settings] => Array
                (
                )

            [module] => field_sql_storage
            [active] => 1
            [details] => Array
                (
                    [sql] => Array
                        (
                            [FIELD_LOAD_CURRENT] => Array
                                (
                                    [field_data_field_slider_image] => Array
                                        (
                                            [fid] => field_slider_image_fid
                                            [alt] => field_slider_image_alt
                                            [title] => field_slider_image_title
                                        )

                                )

                            [FIELD_LOAD_REVISION] => Array
                                (
                                    [field_revision_field_slider_image] => Array
                                        (
                                            [fid] => field_slider_image_fid
                                            [alt] => field_slider_image_alt
                                            [title] => field_slider_image_title
                                        )

                                )

                        )

                )

        )

    [foreign keys] => Array
        (
            [fid] => Array
                (
                    [table] => file_managed
                    [columns] => Array
                        (
                            [fid] => fid
                        )

                )

        )

    [indexes] => Array
        (
            [fid] => Array
                (
                    [0] => fid
                )

        )

    [id] => 27
    [field_name] => field_slider_image
    [type] => image
    [module] => image
    [active] => 1
    [locked] => 0
    [cardinality] => 1
    [deleted] => 0
    [columns] => Array
        (
            [fid] => Array
                (
                    [description] => The {file_managed}.fid being referenced in this field.
                    [type] => int
                    [not null] => 
                    [unsigned] => 1
                )

            [alt] => Array
                (
                    [description] => Alternative image text, for the image's 'alt' attribute.
                    [type] => varchar
                    [length] => 128
                    [not null] => 
                )

            [title] => Array
                (
                    [description] => Image title text, for the image's 'title' attribute.
                    [type] => varchar
                    [length] => 128
                    [not null] => 
                )

        )

    [bundles] => Array
        (
            [node] => Array
                (
                    [0] => featured_slider
                )

        )

)
amitaibu’s picture

Sorry, a human can't read this backtrace :)

> $entity is an optional argument in hook_field_access, is it not?

Not -- http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...

Apart of OG and OG field access what other contrib modules to you have installed?

othermachines’s picture

Contrib:

admin
colorbox
context
context_og
context_ui
ctools
devel
devel_node_access
diff
entity
features
file_entity
file_styles
libraries
link
media
media_internet
media_youtube
og
og_access
og_context
og_field_access
og_ui
og_node_link
og_theme
og_create_perms
og_views
page_manager
panels
pathauto
strongarm
styles
styles_ui
token
views
views_content
views_slideshow
views_slideshow_cycle
views_ui
wysiwyg

amitaibu’s picture

Please replace, for debugging, in og_field_access module this function, and attach a screenshot of your findings (make sure devel is enabled and all users have devel permissions enabled)


/**
 * Implements hook_field_access().
 */
function og_field_access_field_access($op, $field, $entity_type, $entity, $account) {
  if (empty($entity)) {
    dpm(array($op, $field, $entity_type, $entity, $account));
  }

  $perm = $op == 'view' ? 'view ' . $field['field_name'] . ' field' : 'update ' . $field['field_name'] . ' field';
  // If the entity isn't related to OG, return TRUE, so we don't deny access.
  return og_user_access_entity($perm, $entity_type, $entity, $account, FALSE);
}
andrés chandía’s picture

admin_language/ ctools/ i18nviews/ link/ og_create_perms/ pathauto/ translation_overview/
admin_menu/ demo/ l10n_client/ module_filter/ transliteration/
advanced_help/ entity/ l10n_update/ nice_menus/ og_subgroups/ smtp/ variable/
captcha/ extlink/ languageicons/ noggin/ og_theme/ superfish/ views/
ckeditor/ i18n/ libraries/ og/ panels/ token/ views_slideshow/

amitaibu’s picture

@othermachines,
It seems that Views is calling the field access -- please disable the view on the page you look, and confirm this is the case.

amitaibu’s picture

Ok, I see the problem. Views, is calling field_access() without an entity, which turns out to be indeed optional. Will commit a fix soon.

amitaibu’s picture

Status: Active » Fixed

Please get latest -dev from GIT, or wait a few hours to download, and confirm fix -- http://drupalcode.org/project/og.git/commitdiff/310d349

If fixed, I'll (sadly) roll a new version

othermachines’s picture

That's good news to arrive home to. Fix works for me. Thx, Amitaibu -

andrés chandía’s picture

Perfectly working, even modules "OG create permissions", "Organic groups subgroups", "OG subgroups views integration" are working charmly.

amitaibu’s picture

7.x-1.3 will soon be public -- http://drupal.org/node/1324936

andrés chandía’s picture

Now when I create any content as no admin user I get this warning, but the content is created anyway:

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of .../includes/entity.inc).

This warning appears at the moment I select any kind of content to create.

amitaibu’s picture

@ Andrés Chandía,
Please disable everything not related to OG and try again.

RobKoberg’s picture

Just upgraded and hit this issue. And just as I figured out it was with og_field_access the fix comes out! Thanks for the fast action Amitai!

andrés chandía’s picture

Do you mean all the modules in the site or those at the OG wich do not come with OG core?, like "OG create permissions"

amitaibu’s picture

amitaibu’s picture

I've added tests to #1325378: When checking entity access, return early if entity isn't saved yet . I'll appreciate people getting latest -dev and confirming everything in (finally) fixed :/

othermachines’s picture

Confirmed #23 fixed.

Status: Fixed » Closed (fixed)

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