Hi(ericduran). I'm working on reply module which is basically an attachable entity(ie. through field can be attached to another entity) and I've noticed that when I'll use fivestar field with it I get these errors:
Notice: Undefined index: average in ..\fivestar\includes\fivestar.field.inc on line 525
Notice: Undefined index: average in ..\fivestar\includes\fivestar.field.inc on line 570
Notice: Undefined index: count in ..\fivestar\includes\fivestar.field.inc on line 571
So I've looked at you'r code and found out that those missing indexes are set in fivestar_field_prepare_view. I have also found that this hook isn't triggered which is surprising. So I've tried to see if this hook is triggered with another(not fivestar) fields and it turned out it is. I haven't gone through your whole code so I have to ask: is there some unusual logic that you are using that coul'd be the reason of this behavior? I think that my module is responsible for this but since the hooks of other fields are triggered I thought I'll give it a shot.
Comments
Comment #1
dzieyzone commentedExperience the same problem. This only happens when it is being attached. Editing a reply working fine.
Comment #2
tr commentedNo further reports of this behavior, and the Reply module hasn't been worked on in almost 10 years.
fivestar_field_prepare_view() is an implementation of the core hook hook_field_prepare_view(). I don't know of any situation that could happen to prevent core from invoking a valid hook function, unless fivestar.field.inc wasn't loaded into memory in the first place. Drupal 7 DID have problems with include files like this where they weren't always loaded when needed, but that's not something we can really track down here so many years after the fact.
If this continues to be a problem for someone, please open a new issue.