Active
Project:
File Entity (fieldable files)
Version:
7.x-2.37
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2023 at 16:57 UTC
Updated:
16 Feb 2024 at 21:05 UTC
Jump to comment: Most recent
Comments
Comment #2
joseph.olstadSee comment #88 here:
#1778572-88: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7562
Comment #3
joseph.olstadComment #4
theorichel commentedThank you very much!
I have applied this patch: https://www.drupal.org/project/drupal/issues/2931500 as per your suggestion
and it gave me back my site which is great), though the error message 'EntityMalformedException..) remains on top of my pages.
When I flush my cache I get:
Warning: session_set_save_handler(): Cannot change save handler when headers already sent in drupal_session_initialize() (line 245 of /home/customer/www/theorichel.nl/public_html/includes/session.inc).
Warning: session_start(): Cannot start session when headers already sent in drupal_session_start() (line 304 of /home/customer/www/theorichel.nl/public_html/includes/session.inc).
Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/theorichel.nl/public_html/includes/common.inc:1) in drupal_send_headers() (line 1555 of /home/customer/www/theorichel.nl/public_html/includes/bootstrap.inc).
Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/theorichel.nl/public_html/includes/common.inc:1) in drupal_send_headers() (line 1555 of /home/customer/www/theorichel.nl/public_html/includes/bootstrap.inc).
Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/theorichel.nl/public_html/includes/common.inc:1) in drupal_send_headers() (line 1555 of /home/customer/www/theorichel.nl/public_html/includes/bootstrap.inc).
..... and more of the same.
For the warning Drupal suggests patching the statistics module, but that has alread been done.
Comment #5
joseph.olstadI saw this issue myself this weekend, it came up when I tried to load an entity that was already loaded, I had to back off some of my custom code that was re-loading the entity, I ended up figuring out that the entity was already there and I didn't need to load it again in my custom code.
Check your custom code and recent changes that may have brought this issue up?
Comment #6
theorichel commentedIm not smart enough for custom code, but I did remove some modules though I do not know which ones anymore. Can I still see that history in my database?
Comment #7
joseph.olstadif you run update.php or drush updb your site should warn you about modules that were removed from the filesystem but not uninstalled.
Comment #8
theorichel commentedI get access denied when I try to run update.php . The rest of the site (be it with the Malformed error and without theming) is accessible.
Comment #9
joseph.olstad@TheoRichel,
You'll need to be logged in with an administrator role to access update.php
Please try again.
If you forgot your password but you have a terminal access you can use the login token generated using
drush uli;Comment #10
theorichel commentedSorry but I am logged in. I can install and uninstall modules, always accompanied by the mentioned errors, but it works. Update.php though says access denied.
Comment #11
joseph.olstadIt's possible that someone intentionally removed Update.php from your build.
You may want to make sure you're logged in as user id 1 (administrator)
the
drush ulicommand gives a token that will log you in as user id 1 provided you're logged out before using the token.Comment #12
jon nunan commentedAfter some debugging I found:
https://api.drupal.org/api/drupal/includes%21entity.inc/function/DrupalD...
You'll see when building the query it grabs a list of fields from:
$entity_fields = $this->entityInfo['schema_fields_sql']['base table'];For whatever reason, the values in 'schema_fields_sql' do not include the bundle field. So when the file entity is loaded via that controller it will be missing its bundle and trip up entity_extract_ids().
I think the issue is hook_schema_alter(); should that be in .install or should it be in .module?
When debugging and clearing cache, I don't hit a breakpoint I place inside `file_entity_schema_alter()` in its current location in the `.install` file. I think that hook only gets picked up if its in the module file? I tried moving the hook to the .module file, and while I now hit the breakpoint I cache clear the issue still remains.
I found I could fix the issue by just hardcoding the bundle field in the entity_info_alter() but this feels like a hack and there is something else I'm missing
Comment #13
joseph.olstadHmm, ya, strange , try upgrading to 7.x-2.38 and Drupal core to 7.99
sounds like this is fixable, with that said, this is something I've seen in the past, sounds like it's something that can be fixed outside of file_entity, but with that said, feel free to elaborate a patch if that helps.
Comment #14
anybodyI'm running into this after updating to 7.x-2.38 (from 7.x-2.37) and Drupal 7.99. Still unclear, why it happens in my case...
Comment #15
anybodyAny ideas how we can get more information about the root cause?
May this be a single malformed (file) entity? I see some file entities without type in my file list (fonts and csv's).
For now I'm using the hack from #12 successfully.
Comment #16
joseph.olstad@Anybody,
you could disable the hack and debug entity_extract_ids() in core
includes/common.incTry to find out which ones are crashing, work backwards.
So you're saying you have file entities without type in your file list? fonts and csvs? Maybe you can simply add a type and update your file_managed records that have no type?
or the file entity records, have to see where that's stored.