Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using additional flags with harmony, the flag_access_multiple hook will return a null value from harmony and will cause flag to error. Obviously this also needs to be fixed with harmony, but it doesn't hurt to patch it here.
The error occurs on line line 568 in flag_flag.inc I fixed it by adding if ($module_access)
before the foreach loop.
The error in question:
Warning: Invalid argument supplied for foreach() in flag_flag->access_multiple() (line 568 of /flag/includes/flag/flag_flag.inc).
Comments
Comment #1
joachim CreditAttribution: joachim commented> the flag_access_multiple hook will return a null value from harmony and will cause flag to error. Obviously this also needs to be fixed with harmony, but it doesn't hurt to patch it here.
Yup, it's up to harmony to fix it. If a module, such as Flag, exposes a hook for other modules to implement, it's up to those modules to do so properly. Flag shouldn't have to babysit what the implementing modules return.
However, I'll grant you that the docs for the hook could do to mention that an empty array should be returned rather than NULL when the hook implementation has nothing to say:
I'll take a patch for that :)
Comment #2
joachim CreditAttribution: joachim commentedFixed.