See the title for the approx. cause.

In the log I get a PHP notice:

Notice: Undefined index: entity_from_field:field_image-node-file in ctools_entity_from_field_get_child() (line 22 of /home/xxx/public_html/xxx/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc).

and an EntityMalformedException:

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7389 of /home/xxx/public_html/xxx/includes/common.inc).

Seeing as the notice mentions ctools I thought I'd check in here as I'm not having a whole lot of luck elsewhere. I understand that the second message is likely linked to http://drupal.org/node/1277376#comment-5041700 but that thread seems to point the finger at contrib modules generally and I'm having no joy isolating what module might be causing this problem.

Any ideas?

CommentFileSizeAuthor
#7 ctools-empty_context-1292098-13.patch807 bytesmikeker

Comments

dddbbb’s picture

I'm also getting the first error (only it's on line 24) but I'm not even trying to create anything - just viewing already created content.

tomogden’s picture

For me this error only ever occurs at the /user page, after I have logged in. And yes, it is on line 24 now.

Notice: Undefined index: entity_from_field:group_audience-user-group in ctools_entity_from_field_get_child() (line 24 of /var/www/html/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc).

merlinofchaos’s picture

Hmm. A relationship on a broken entity perhaps. The relationship code may need to validate source data better.

Funksmaname’s picture

I had exactly the same issue after deleting a content type that was being referenced by page variants. I think they were set to validate the content type before issuing a page redirect - deleting all varients that had anything to do with the deleted content type got rid of the error.

Hope this helps!

szantog’s picture

Title: Error when trying to create nodes of certain content types when logged in as user with admin role » Check if entity exists and loadable before inject it as a context
Category: bug » task

I think this is not a bug. You have to make sure the context is exists, before using.

An example:

Content type foo contains an entity reference field to the content type bar. Content type bar contains a check_it checkbox.
You set up a relationship from the entity reference field to the content type bar. Add a visibility rule to a pane, based on field: Node bar: check_it Add the relationship to this rule.

Then if you see a foo type content, everything will be fine. Then visit a bar type content, you will get the same, as in the issue summary.

The solution is, add a visibility rule Context exists, before the visibility rule of field value checking. You can add the context checking to the access settings also.

But you are right, it would be better, if the missing relationship would be skipped automatically.

merlinofchaos’s picture

Category: task » bug

No, I think it is a bug; the content type shouldn't produce warnings because it saw an empty context. Empty contexts are valid input, and since they are empty they should simply have no output.

Most content types check for empty data, so we just need to make sure that the content type that is putting out this error is appropriately sanity-checking all data it uses.

mikeker’s picture

Status: Active » Needs review
StatusFileSize
new807 bytes

Can we fail the access check if the context doesn't exist? (see attached)

My project had some complicated visibility rules that didn't allow me to put a Context Exists check before checking the value of an entity ref.

tgeller’s picture

Status: Needs review » Reviewed & tested by the community

I applied the patch and the error disappeared from my site. (I can't confirm anything else about it.) Ready to go?

japerry’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

szt’s picture

Status: Closed (fixed) » Active

Same notice, with the latest dev...

Notice: Undefined index: entity_from_field:field_hirek_szervezet-node-node ctools_entity_from_field_get_child() függvényben (/media/sf_dev/xxx.xxx.loc/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc 24 sor).

In addition every page gives WSOD, except admin pages with admin theme.

I've just added some relationship and contextual filter to a view...

Yuri’s picture

I confirm that this error message still appears using the latest dev of ctools. Adding a panel pane is impossible, each time when trying to add a panel pane, ajax error 500 comes up, with this error message in the log. It makes my site unusable as an admin, thus I see this as a major issue.

mikeker’s picture

Status: Active » Closed (fixed)

Keep in mind that a given error on a given line can be caused by many different situations. This issue was limited to empty Panels contexts causing errors when used in access plugins and the solution is very specific to this situation. I've been running with this patch for a year without seeing any of the issues mentioned in #11 and #12.

I think you'll get better traction if you open a new issue with the specifics of your situation. Including an export of a View/Panels that will reproduce the error is also very helpful.

aaronbauman’s picture

szt, Yuri, did you open a new issue?