line 244 in field_sql_norevisions.module fails if $entity_info['entity keys']['bundle'] is empty, which was the case for user bundle
242: $entity_info = entity_get_info($entity_type);
244: if(empty($enabled_entity_bundles['field_sql_norevisions_' . $entity_type .'_' . $entity->{$entity_info['entity keys']['bundle']} . '_enabled'])) {
$entity_info['entity keys']['bundle'] is empty, so it tried to access empty property of $entity object
I changed line 244 to:
if(empty($entity_info['entity keys']['bundle']) || empty($enabled_entity_bundles['field_sql_norevisions_' . $entity_type .'_' . $entity->{$entity_info['entity keys']['bundle']} . '_enabled'])) {
so it falls back to "normal SQL storage function" , which saves the user object correctly
maybe the error comes from entity_get_info('user') and is not related to field_sql_norevisions?? Have no time to dig deeper...
I have set
Disable SQL revisions for User entity bundles
[X] User
in admin/config/system/field_sql_norevisions/field_sql_norevisions_entity_settings
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | field_sql_norevisions-problem_saving_user_fields-2238619-2.patch | 1.1 KB | antongp |
Comments
Comment #1
rvelhote commentedI am testing this module and had the same problem today.
For the user entity the $enabled_entity_bundles variable returns
but in the user entity the $entity_info['entity keys']['bundle'] is empty so we just have to concatenate the correct full string and maintain the thing. Most likely it will break in case this pattern is invalid for another entity type.
I fixed it (well... hacked :P) like this (sorry, no GIT diff).
Comment #2
antongp commentedHi! Why not to use entity_extract_ids() instead?
Comment #3
antongp commentedHi
Could you please review the patch from my previous comment and apply it to the 7.x-2.x or solve the problem in some "more proper" way.
Issue is related not only to user entity type, but to any entity type which defines only one bundle and as result do not provide $entity_info['entity keys']['bundle'] in the hook_entity_info() implementation ('bundle' property is optional). It's enough to have at least one field attached to such entity type/bundle and Field SQL norevisions module enabled (so it is even not needed to enable this entity type on the settings page to not use revisions) to cause the issue. It causes fatal error, for example, on saving of account via form or programmatically...
Marking issue as major... Thank you
Comment #4
pwaterz commentedcommitted http://cgit.drupalcode.org/field_sql_norevisions/commit/?id=8681089
Rolling out 7.x-2.1 today as this is a major bug
Comment #6
antongp commentedThanks much! Looks there are no major issues in 7.x-2.x now (really cool!), only a few minor (would be nice to have them fixed as well :)).