Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Not an Issue
-
Affects Version/s: 1.10.1
-
Fix Version/s: None
-
Component/s: Zend_Cache
-
Labels:None
Description
I'm trying to use Zend_Cache_Backend_Static like this:
Bootstrap.php
protected function _initCache() { $manager = new Zend_Cache_Manager(); $manager->setCacheTemplate('page', array( 'frontend' => array( 'name' => 'Capture', 'options' => array( 'ignore_user_abort' => true, 'automatic_serialization' => true ), ), 'backend' => array( 'name' => 'Static', 'options' => array( 'public_dir' => 'cache', ), ), )); $manager->getCache('page')->start('nothing', array()); }
Firstly, why i have to specify $id and $tag in start()? Why not just $manager->getCache('page')->start()?
Then, in Zend_Cache_Backend_Static:
if (is_null($id) || strlen($id) == 0) { $id = $this->_detectId(); } else { $id = $this->_decodeId($id); }
But $id couldn't ever be null or "". It's impossible to call start('', array()), because Zend_Cache_Core::_validateIdOrTag will throw exception {{"Invalid id or tag '$string' : must use only [a-zA-Z0-9_]"}}. So, $id = $this->_detectId(); will never be executed, and $id = $this->_decodeId($id); will produce wrong filename.
Then, in
$pathName = realpath($this->_options['public_dir']) . dirname($id);
$pathName become "bla-bla/public/cache.", and name of file to be created become "bla-bla/public/cache./index.html".
So, is it's my mistake or it's really BUG?
Reassigned for Padraic