Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Zend_Cache_Backend_Libmemcached doesn't pass Memcached::OPT_NO_BLOCK option through #53

zfbot opened this Issue · 1 comment

2 participants


Jira Information

Original Issue: ZF-12517
Issue Type: Bug
Reporter: ctoomey
Created: 02/03/13
Components: Zend_Cache


A bug in Zend_Cache_Backend_Libmemcached causes it not to pass the Memcached::OPT_NO_BLOCK client option setting through Memcached::setOption(). This means that one cannot put libmemcached in non-blocking mode and hence set timeouts on socket polling, which is the only way I've found to time limit load() calls.

The bug is on line 135 (of the 1.12.1 release code). Memcached::OPT_NO_BLOCK has value 0, hence the if condition fails and the option isn't set. The if clause should instead be {{!is_null($optId)}}.

   122          // setup memcached client options
   123          foreach ($this->_options['client'] as $name => $value) {
   124              $optId = null;
   125              if (is_int($name)) {
   126                  $optId = $name;
   127              } else {
   128                  $optConst = 'Memcached::OPT_' . strtoupper($name);
   129                  if (defined($optConst)) {
   130                      $optId = constant($optConst);
   131                  } else {
   132                      $this->_log("Unknown memcached client option '{$name}' ({$optConst})");
   133                  }
   134              }
   135              if ($optId) {
   136                  if (!$this->_memcache->setOption($optId, $value)) {
   137                      $this->_log("Setting memcached client option '{$optId}' failed");
   138                  }
   139              }
   140          }

This issue was ported from the ZF2 Jira Issue Tracker at

Known GitHub users mentioned in the original message or comment:

@holtkamp holtkamp referenced this issue from a commit
@holtkamp holtkamp Allow setting Memcached::OPT_NO_BLOCK

The value of the constant is '0', which the old approach filtered out
@froschdesign froschdesign self-assigned this
@froschdesign froschdesign added this to the 1.12.6 milestone
@xopherdeep xopherdeep referenced this issue from a commit in xopherdeep/Zend-Framework-v1
@froschdesign froschdesign Fixes #53 - Zend_Cache_Backend_Libmemcached doesn't pass Memcached::O…
…PT_NO_BLOCK option through
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.