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

MmMnRr created an issue. See original summary.

MmMnRr’s picture

Issue summary: View changes
MmMnRr’s picture

Issue summary: View changes
MmMnRr’s picture

Version: 7.x-3.11 » 7.x-3.13

I 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.

renatog’s picture

Category: Bug report » Support request
Status: Active » Fixed

Hello 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

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.