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.
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.
Comment | File | Size | Author |
---|---|---|---|
memcache_invalid_arg_foreach.patch | 392 bytes | rupertj |
Comments
Comment #1
rupertj CreditAttribution: rupertj commentedActually, 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
Comment #2
joshk CreditAttribution: joshk commentedSeeing this quite a lot on sites. Patch works for me.
Comment #3
muschpusch CreditAttribution: muschpusch commentedplease commit! I get this on node edit pages... The patch works...
Comment #4
jghyde CreditAttribution: jghyde commentedTested 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
Comment #5
catchCommitted 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
Comment #6
rupertj CreditAttribution: rupertj commentedNo worries. I'm not in it for the credit ;)