When I create and save an entity reference field for file entity. It prompt below error.
Note: Undefined property: stdClass::$fid in file_entity_access()
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | fix_entity_api_create_access-2312603-21.patch | 1.24 KB | joseph.olstad |
| #18 | fix_entity_api_create_access-2312603-18.patch | 1.55 KB | sheena_d |
| #16 | fix_entity_api_create_access-2312603-16.patch | 1.58 KB | sheena_d |
| #8 | fix_entity_api_create_access-2312603-8.patch | 725 bytes | jimmyko |
| #5 | 2312603-fix-entity-api-create-access.patch | 802 bytes | dave reid |
Comments
Comment #1
jimmyko commentedComment #2
jimmyko commentedBacktrace record generated by devel module.
14: file_entity_access() (Array, 2 elements)
13: entity_access() (Array, 2 elements)
12: inline_entity_form_settings() (Array, 2 elements)
11: inline_entity_form_get_controller() (Array, 2 elements)
10: inline_entity_form_field_widget_settings_form() (Array, 2 elements)
9: call_user_func_array() (Array, 1 element)
8: module_invoke() (Array, 2 elements)
7: field_ui_field_edit_form() (Array, 2 elements)
6: call_user_func_array() (Array, 1 element)
5: drupal_retrieve_form() (Array, 2 elements)
4: drupal_build_form() (Array, 2 elements)
3: drupal_get_form() (Array, 2 elements)
2: call_user_func_array() (Array, 1 element)
1: menu_execute_active_handler() (Array, 2 elements)
0: main() (Array, 2 elements)
Comment #3
jimmyko commentedDetails of the last function called:
Comment #4
jimmyko commentedI created a patch for detecting if fid property is existing.
Comment #5
dave reidLet's try this version.
Comment #6
dave reidComment #7
jimmyko commentedMaybe we can just remove it
$cache_id = NullComment #8
jimmyko commentedComment #9
mkhamash commentedI think this patch helps to solve a lot other issues, especially for modules like media_internet and feeds integration modules since most of them will create a file object using file_uri_to_object() and will not have a fid yet and are trying to validate the file (file type) using file_entity_access().
Comment #10
jimmyko commentedComment #11
neograph734This also covers an issue when files are uploaded using Services API and its REST submodule. Took us quite a while to figure out this was a function of file_entity and not core...
Would be nice to get this in the next release.
Comment #12
rajab natshah+1
Comment #13
rajab natshahTested - still works with 2.0-beta3
Comment #14
jimmyko commentedCan any contributor of this module can help to review and confirm this patch?
Comment #15
lessmoreless commentedIs there by any chance of editing the module from the backend, instead of accessing the files, I have run into the above error and ive got limited access to the files but just the backend.
Comment #16
sheena_d commentedI've run into an issue where a contrib module actually passes an empty new entity to entity_access(). This results in an inaccurate access denied result for users who are allowed to create new file entities.
I'm attaching a patch that supports the instance of a new, empty file entity being passed in to check for creation access.
Comment #18
sheena_d commentedTrying my patch again.
Comment #19
alisonHi all, I was getting this error when my feeds importer ran (it maps feed items to Event nodes, including images getting mapped to an image field on the Event content type). I applied the patch from #5 and the errors went away -- yay! I have file_entity 7.x-2.2, I just finally updated from 7.x-2.0-beta3 last week -- I'm confident that the errors started after the update, I confirmed on a different environment that they were not happening before.
I'm not sure if the situation described in #16 applies to me, so that's why I held off on trying the later versions of the patch, but I'll keep following this issue. Thanks for all the patchwork ;-)
(in other words, *bump* haha)
Comment #20
joseph.olstadComment #21
joseph.olstadI prefer initializing cache_id for scope, as did Dave Reid
see patch
interdiff is this:
+ $cache_id = NULL;Comment #22
joseph.olstadHi @alisonjo2786 , can you please back off patch #5 and try out patch #21 instead? Then please report the test results back here.
Thanks
Comment #24
joseph.olstadComment #25
alisonHi @joseph.olstad -- yeppers!
-- Reversed patch from #5, confirmed that the notices happen at that point ("just in case")
-- Applied patch from #21 -- no more notices
-- (and no side effects on other stuff, AFAIsee -- i.e. files are coming in with my imported feed items and getting mapped/saved on my event nodes just fine)