Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Closed
zfbot opened this Issue Apr 5, 2013 · 1 comment

Comments

Projects
None yet
2 participants

zfbot commented Apr 5, 2013

Jira Information

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

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          }

zfbot commented Apr 5, 2013

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF-12517

Known GitHub users mentioned in the original message or comment:
@ctoomey

@froschdesign froschdesign self-assigned this Mar 19, 2014

@froschdesign froschdesign added this to the 1.12.6 milestone Mar 19, 2014

xopherdeep pushed a commit to xopherdeep/Zend-Framework-v1 that referenced this issue Jul 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment