I've got a warning

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in array_flip() (line 359 of /www/htdocs/v342791/public/bambali2012/includes/entity.inc).

It's caused by Rules (rules_unwrap_data(), line 445, "$value = $entry->value($options)") when trying to access a property of an anonymous user.

My scenario in which the anonymous user was attempt to be unwrapped was quite exotic: VBO provided a list of nodes, I looped through it and put all authors into a list of users. Some node authors were anonymous, because Devel generates nodes like this.

However, this situation is less exotic regarding the possibility to assign content to anonymous when the original author's account is deleted.

I have the impression my English is too limitted to describe the issue sufficiently. So in case things are not clear, please feel free to ask.

Comments

Anonymous’s picture

Issue summary: View changes

corrected and extended some details

Andre-B’s picture

this explains why I have this notices, did exactly the same: vbo to get a list of users, added an anonymous user to that list, and all of it got stored for later processing as a scheduled component evaluation

Andre-B’s picture

Issue summary: View changes

clarify a bit more

TR’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

I recognize that core Drupal does not use a true entity for anonymous users like it does with authenticated users. Instead, it uses an array of values in some places and a stdClass() in other places. Neither of those will have the same properties/defaults/methods as a user entity, and as a result anonymous user 'objects' can't be used in the same way or in the same places as user entities are. This is a really poor architectural feature of core Drupal which impacts Rules in several ways - the above is just one. Another is operating on user roles - trying to access the roles of an anonymous user also generates errors.

Unfortunately, this is very much due to core Drupal, and I don't think there's any chance that core Drupal 7 will fix this, especially this late in the D7 development cycle.

I think this can be worked around in most cases, but if there is a specific case where you can suggest a fix and provide a patch for specific Rules events, conditions, or actions I am open to committing that. Please open a new issue for each specific case.