I get the following warning when doing "drush cc all" on a site using memcache:

php: Warning: Invalid argument supplied for foreach() in MemCacheDrupal->getMultiple() (line 31 of /home/subhub/core3/sites/all/modules/memcache/memcache.inc).

This appears to be from a cache miss - $mc->getMulti() returns false inside dmemcache_get_multi(), and then this result gets fed to a foreach in MemCacheDrupal::getMultiple().

The attached patch ensures that dmemcache_get_multi returns an empty array instead of false for a cache miss.

CommentFileSizeAuthor
memcache_invalid_arg_foreach.patch392 bytesrupertj
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rupertj’s picture

Actually, I think I've described the issue slightly wrong - it can return false on failure, rather than on a cache miss: http://php.net/manual/en/memcached.getmulti.php

joshk’s picture

Seeing this quite a lot on sites. Patch works for me.

muschpusch’s picture

Status: Needs review » Reviewed & tested by the community

please commit! I get this on node edit pages... The patch works...

jghyde’s picture

Tested the patch memcache_invalid_arg_foreach.patch listed above after running into this problem in Views 3 and D7. It works! The problem I encountered was in the Views UI. Comment or commit!

Joe

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed a slightly modified version of this to 7.x-1.x, thanks!

Ack, I just looked at the commit message and I failed to credit rupertj in the commit message, apologies for that :(

http://drupalcode.org/project/memcache.git/commit/931e6cf

rupertj’s picture

No worries. I'm not in it for the credit ;)

Status: Fixed » Closed (fixed)

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