I am getting the following errors in my logs on every cron run & every time I use update.php:

    Notice: Undefined variable: keys in DrupalAPCCache->getMultiple() (line 172 of /hosting/somesite/com/htdocs/cms_sandbox/sites/all/modules/apc/drupal_apc_cache.inc).
    Warning: array_keys() expects parameter 1 to be array, null given in DrupalAPCCache->getMultiple() (line 172 of /hosting/somesite/com/htdocs/cms_sandbox/sites/all/modules/apc/drupal_apc_cache.inc).

I am using the latest 7x.1x-dev version. Any ideas?

#3 apc-undefined-index-2091647-3.patch445 bytestwistor
Members fund testing for the Drupal project. Drupal Association Learn more


rhclayto’s picture

Issue summary: View changes

Updated issue summary.

rhclayto’s picture

I changed the following to get the notice & warning to go away.

line 172 of drupal_apc_cache.inc was:

$fetch = apc_fetch(array_keys($keys));

Changed to:

 $fetch = isset($keys) ? apc_fetch(array_keys($keys)) : '';

The error messages have gone away & cache creation in & deletion from the APC user cache works.

rhclayto’s picture

Issue summary: View changes
Status: Active » Needs review

Added an isset check to eliminate the persistent error messages.

twistor’s picture

The problem is that getMultiple() is being called with an empty array.

There's 2 ways to solve this.
Predefine keys so that it always exists, or return early if the $cids is empty.
I went with the latter.

  • R.Muilwijk committed 7d411e5 on 7.x-1.x
    Issue #2091647 by twistor: Notice: Undefined variable: keys in...
R.Muilwijk’s picture

Committed to dev.

R.Muilwijk’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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