Since upgrading to the 7.x-2.0-beta3 version I am getting these errors on page 2 of my node_gallery view.
This is only with one gallery. I will try to find out what is the difference with this gallery compared to the others on the same site.

Notice: Undefined property: stdClass::$fid in file_build_content() (line 173 of /sites/all/modules/file_entity/file_entity.file_api.inc).
Notice: Undefined property: stdClass::$fid in file_build_content() (line 174 of /sites/all/modules/file_entity/file_entity.file_api.inc).
EntityMalformedException: Missing bundle property on entity of type file. in entity_extract_ids() (line 7880 of /includes/common.inc).

Comments

Johan den Hollander created an issue. See original summary.

johan den hollander’s picture

Title: Undefined property: stdClass::$fid in file_build_content() (rule 173 » Undefined property: stdClass::$fid in file_build_content() (line 173
dave reid’s picture

Category: Bug report » Support request

It sounds like something is passing an empty file object to file_view() or file_view_multiple().

johan den hollander’s picture

Dave, you gave me a good hint. I had a node in my gallery where the image had gone missing.

Switched back to file_entity 7.x-2.0-beta2, the problem did not arise.
After deleting the corrupted node I upgraded tot beta 3 again and the problem is gone.

Yuri’s picture

comment deleted

steinmb’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

joelstein’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Needs review
StatusFileSize
new1.33 KB

I'm having this same error. Here are steps to reproduce it:

  1. Spin up vanilla install of Drupal and latest releases of Media and File Entity.
  2. Add file field with "Media browser" widget to Articles content type (configure it however you want).
  3. Configure file field with "Rendered file" display formatter.
  4. Create an article and upload a file to it.
  5. Visit "admin/content/file" and delete the file.
  6. Visit the node page, and see the following fatal errors:
Notice: Undefined property: stdClass::$fid in file_build_content() (line 173 of sites/all/modules/file_entity/file_entity.file_api.inc).
Notice: Undefined property: stdClass::$fid in file_build_content() (line 174 of sites/all/modules/file_entity/file_entity.file_api.inc).
EntityMalformedException: Missing bundle property on entity of type file. in entity_extract_ids() (line 7880 of includes/common.inc).

We just need to filter out empty items, which is already being done for some of the File Entity field formatters, but not all. The attached patch fixes this issue (and potentially others).

steinmb’s picture

Category: Support request » Bug report
Priority: Critical » Normal

I see nothing critical about this. If this is, as you write, a clean installation of Drupal the needed modules, there should be none old and broken configs passing empty file objects around. I think checking and omitting, would simply hide the real problem.

joelstein’s picture

We can disagree about the severity of this issue, but the fact remains that it's currently possible for a content editor to break their site by navigating to "admin/content/file" and deleting a file that is referenced elsewhere.

What would it take to get this patch committed?

steinmb’s picture

Version: 7.x-2.0-beta3 » 7.x-2.x-dev

Start by confirming that this is still a issue with the latest dev version of file entity and media.

joelstein’s picture

Yes, this issue exists with the latest dev of both modules. I posted steps to reproduce it above.

dave reid’s picture

Actually I think this should solve it for all our formatters. hook_field_formatter_prepare_view() is useful in this case!

dave reid’s picture

xlin1003’s picture

@Dave Reid, Thanks for the patch. It seems the patch #13 will not resolve the issue when using panel + paragraph (screenshot attached).

You can import the attached panel page txt file to see the error.

dave reid’s picture

@xlin1003: I think paragraph_panes also has a bug in how it loads the field data. When you combine the patch in #2774857: If a file fails to load, the item value should be set to NULL with this one, it should make your error go away.

xlin1003’s picture

Thanks @Dave Reid! Both patches work great!

danielen’s picture

Work for me in file_entity 7.x-2.0-beta2 and file_entity 7.x-2.0-beta3.
Error caused before, because user has removed the file, but not the paragraph itself.
After save the node, the error showed up.

alison’s picture

Hi! The patch works great for me, too -- any guesses on when this might get into the module? (And/or are there any blockers that I might be able to help with?) Thank you!

[EDIT: Still applies fine against 7.x-3.16, fwiw]

steinmb’s picture

Status: Needs review » Reviewed & tested by the community

Patch still apply. Before the patch

In the node, the field_media_image field refers to a file which does not exist. Aborting the render for it.
So probably not as severe as reported #8, but that was one year ago.

With the patch applied. not warnings and no log entries.

joseph.olstad’s picture

Rolling several tests, 5.4, 5.5 , 5.6, 7.0, 7.1
followup soon.

  • Dave Reid authored 1921633 on 7.x-2.x
    Issue #2737817 by Dave Reid, joelstein, xlin1003: Undefined property:...
joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

fixed in 7.x-2.x dev

Status: Fixed » Closed (fixed)

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