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

Issue Type: Bug Created: 2013-02-03T06:30:44.000+0000 Last Updated: 2013-04-05T16:07:00.000+0000 Status: Closed Fix version(s): Reporter: Chris Toomey (ctoomey) Assignee: None Tags: - Zend_Cache

Related issues: Attachments:


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).

<pre class="highlight">
   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          }


Posted by Ralph Schindler (ralph) on 2013-04-05T16:07:00.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.