Issues

ZF-12517: Zend_Cache_Backend_Libmemcached doesn't pass Memcached::OPT_NO_BLOCK option through

Description

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          }

Comments

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf1/issues/53