diff -r 5a6b6e770365 -r 68c69c656a2c web/lib/Zend/Cache/Frontend/Class.php --- a/web/lib/Zend/Cache/Frontend/Class.php Thu May 07 15:10:09 2015 +0200 +++ b/web/lib/Zend/Cache/Frontend/Class.php Thu May 07 15:16:02 2015 +0200 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Class.php 24593 2012-01-05 20:35:02Z matthew $ + * @version $Id$ */ /** @@ -29,8 +29,8 @@ /** * @package Zend_Cache * @subpackage Zend_Cache_Frontend - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cache_Frontend_Class extends Zend_Cache_Core { @@ -53,9 +53,9 @@ * @var array available options */ protected $_specificOptions = array( - 'cached_entity' => null, - 'cache_by_default' => true, - 'cached_methods' => array(), + 'cached_entity' => null, + 'cache_by_default' => true, + 'cached_methods' => array(), 'non_cached_methods' => array() ); @@ -64,23 +64,23 @@ * * @var array */ - private $_tags = array(); + protected $_tags = array(); /** * SpecificLifetime value * * false => no specific life time * - * @var int + * @var bool|int */ - private $_specificLifetime = false; + protected $_specificLifetime = false; /** * The cached object or the name of the cached abstract class * * @var mixed */ - private $_cachedEntity = null; + protected $_cachedEntity = null; /** * The class name of the cached object or cached abstract class @@ -89,25 +89,24 @@ * * @var string */ - private $_cachedEntityLabel = ''; + protected $_cachedEntityLabel = ''; /** * Priority (used by some particular backends) * * @var int */ - private $_priority = 8; + protected $_priority = 8; /** * Constructor * * @param array $options Associative array of options * @throws Zend_Cache_Exception - * @return void */ public function __construct(array $options = array()) { - while (list($name, $value) = each($options)) { + foreach ($options as $name => $value) { $this->setOption($name, $value); } if ($this->_specificOptions['cached_entity'] === null) { @@ -120,7 +119,7 @@ /** * Set a specific life time * - * @param int $specificLifetime + * @param bool|int $specificLifetime * @return void */ public function setSpecificLifetime($specificLifetime = false) @@ -168,11 +167,15 @@ public function setCachedEntity($cachedEntity) { if (!is_string($cachedEntity) && !is_object($cachedEntity)) { - Zend_Cache::throwException('cached_entity must be an object or a class name'); + Zend_Cache::throwException( + 'cached_entity must be an object or a class name' + ); } - $this->_cachedEntity = $cachedEntity; + + $this->_cachedEntity = $cachedEntity; $this->_specificOptions['cached_entity'] = $cachedEntity; - if (is_string($this->_cachedEntity)){ + + if (is_string($this->_cachedEntity)) { $this->_cachedEntityLabel = $this->_cachedEntity; } else { $ro = new ReflectionObject($this->_cachedEntity); @@ -197,6 +200,7 @@ * @param string $name Method name * @param array $parameters Method parameters * @return mixed Result + * @throws Exception */ public function __call($name, $parameters) { @@ -209,14 +213,17 @@ $cacheBool1 = $this->_specificOptions['cache_by_default']; $cacheBool2 = in_array($name, $this->_specificOptions['cached_methods']); $cacheBool3 = in_array($name, $this->_specificOptions['non_cached_methods']); - $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3)); + $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3)); + if (!$cache) { // We do not have not cache return call_user_func_array($callback, $parameters); } - $id = $this->_makeId($name, $parameters); - if ( ($rs = $this->load($id)) && isset($rs[0], $rs[1]) ) { + $id = $this->makeId($name, $parameters); + if (($rs = $this->load($id)) && (array_key_exists(0, $rs)) + && (array_key_exists(1, $rs)) + ) { // A cache is available $output = $rs[0]; $return = $rs[1]; @@ -228,8 +235,12 @@ try { $return = call_user_func_array($callback, $parameters); $output = ob_get_clean(); - $data = array($output, $return); - $this->save($data, $id, $this->_tags, $this->_specificLifetime, $this->_priority); + $data = array($output, $return); + + $this->save( + $data, $id, $this->_tags, $this->_specificLifetime, + $this->_priority + ); } catch (Exception $e) { ob_end_clean(); throw $e; @@ -261,5 +272,4 @@ { return md5($this->_cachedEntityLabel . '__' . $name . '__' . serialize($args)); } - }