ZF-8932: Zend_Cache_Manager breaks when for empty options
Description
Some cache backend adapters does not require options. When i tried set a template from .ini file a unexpected behavior happens
i've put this in my .ini file
resources.cachemanager.something.frontend.name = Core resources.cachemanager.something.frontend.options.lifetime = 7200 resources.cachemanager.something.frontend.options.automatic_serialization = true resources.cachemanager.something.backend.name = Apc
after i try do this
$cache = $bootstrap->cachemanager->getCache('something');
Expected result
$cache instanceof Zend_Cache_Core; // true
Actual Result
PHP error: Zend_Cache_Backend_Apc::__construct() expects array, null given
i've tried this resources.cachemanager.something.backend.options[] = but not work as well, because this is translated to array(0 => '') so i got Zend_Cache_Exception "Incorrect option name : 0"
It doesn't happens when some option for cache_backend is configured
Possible Solution
when a new template is setted in Zend_Cache_Manager::setCacheTemplate() it may check 'options' index and create this one as a empty array (for both side, frontend and backend)
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2010-01-25T11:41:23.000+0000
Fixed in trunk and 1.10 release branch; simply omit the options if none are needed.