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.
On Drupal 7.22 and PHP 5.4, flag_handler_field_ops->query() function calls trigger a notice as the join field index is sometimes not defined but used.
Notice: Undefined index: join field in flag_handler_field_ops->query() (line 78 of /****/sites/all/modules/flag/includes/flag_handler_field_ops.inc).
Notice: Undefined index: join field in flag_handler_field_ops->query() (line 104 of /****/sites/all/modules/flag/includes/flag_handler_field_ops.inc).
Comment | File | Size | Author |
---|---|---|---|
#1 | flag-7.x-2.1-issue-1993578.patch | 623 bytes | prston |
Comments
Comment #1
prston CreditAttribution: prston commentedPlease find the patch in attachment.
Evaluating $info['join field'] returns NULL at it is undefined. So my patch just set it to NULL manually, before it trigger the notice at lines 78 and 104.
Line 78:
As described at http://api.drupal.org/api/views/includes!handlers.inc/function/views_join%3A%3Aconstruct/7 the third parameter ($left_field = NULL) of the construct() method can be NULL.
Line 104:
But following http://api.drupal.org/api/views/plugins!views_plugin_query_default.inc/7 the second parameter $field of the add_field() method cannot be NULL as it's used later and not escaped. I wonder if it has some side effect somewhere.
Comment #2
joachim CreditAttribution: joachim commentedThanks for reporting and figuring out the problem!
Could you try this on 3.x please? Bugs need to be fixed on the development branch, then backported.
Check the Drupal coding standards too -- if() blocks always need enclosing {}, even if a single line.
I'm also not sure when 'join field' can be undefined: the $info array is obtained from this:
Comment #3
sewhaa CreditAttribution: sewhaa commentedI get this very same error but somehow the patch does not work for me. and i cant find any video to walk me through
Comment #4
joachim CreditAttribution: joachim commentedI'm going to need more information on how to reproduce this bug.
Comment #5
manumad40 CreditAttribution: manumad40 commentedThese issues identify the origin of this problem and it seems they solve it:
#1647144: Default "like" flag can conflict with existing flags named "like"
#1689502: Error when enabling flag submodules for status module
So, I'm closing this. To avoid duplicates, this issue can continue here it the problem presists:
#1782910: How to deal with multiple modules providing a default flag with the same name?
Comment #6
manumad40 CreditAttribution: manumad40 commented