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.
After upgrading from Drupal 7.41 to Drupal 7.43, I found that my Views are producing the following notice error when using PHP contextual filter code:
Notice: Undefined index: args in DatabaseLog->findCaller() (line 156 of .../includes/database/log.inc).
By debugging, I know that this is produced by PHP contextual filter in Views. Specifically by line 53 of views/plugins/views_plugin_argument_default_php.inc
Below is my PHP contextual filter code:
$filter = array();
if (module_exists('mymodule')) {
$url = drupal_get_path_alias(current_path());
$query = db_query(
'SELECT cp.contact_person_id
FROM {mymodule_table} cp
WHERE cp.website_section_url LIKE :url_to_find', array(':url_to_find' => $url));
foreach ($query as $row) {
$filter[] = $row->contact_person_id;
}
}
return implode('+',$filter);
The SQL query works correctly.
The view is a Block.
What could be happening?
Comments
Comment #2
MmMnRr CreditAttribution: MmMnRr commentedComment #3
MmMnRr CreditAttribution: MmMnRr commentedComment #4
MmMnRr CreditAttribution: MmMnRr commentedI also updated Views to 7.x-3.13 version but the issue is still present.
So the problem appears in both 7.x-3.11 and 7.x-3.13 versions.
Comment #5
renatogHello MmMnRr how are you? Thank you for reporting this. I've been testing here using the last drupal stable version: 7.81 with the upgrade to the last version as well 7.x-3.24 and after that I used a similar PHP snipped and it worked well. My recommendation on that case is to update to the last Drupal version and the last Views version as well. Run all updates on update.php and clear all caches. It will work normally. Please try it because here it worked. If you have any problems during this process feel free to reopen and let us know about it. Thank you so much MmMnRr