ZF-3582: Zend_Cache cannot have custom backend/frontend
Description
The Zend_Cache controller has a bug which makes it impossible for a custom class to be used for the backend or frontend.
e.g.
bootstrap call:
$cache=Zend_Cache::factory('Core','Project_Cache_Backend_MemcacheExt', array('lifeTime'=>null, 'automatic_serialization'=>true), array('servers'=>$config->cache->toArray())),null,true);
in the factory function the first two calls are the issue: $frontend = self::_normalizeName($frontend); $backend = self::_normalizeName($backend);
normalize name changes $backend to
Projectcachebackendmemcacheext
now none of the logic to find the class name will work later on in the function because backend has already been "normalized"
if ($customBackendNaming) {
// we use this boolean to avoid an API break
$backendClass = 'Zend_Cache_Backend_' . $backend;
} else {
$backendClass = $backend;
}
if (!$autoload) {
$file = str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
if (!(self::_isReadable($file))) {
self::throwException("file $file not found in include_path");
}
require_once $file;
}
Don't know if this has been resolved yet. Seems simple to fix.
thx
Comments
Posted by Graham Hensley (chiatar) on 2008-07-04T18:07:39.000+0000
sorry. typo fixed -chiatar
Posted by Fabien MARTY (fab) on 2008-07-05T05:41:33.000+0000
just fixed in SVN trunk (thanks)
can you try it ?
The syntax you have to use :
You have to do the "require_once" of your specific backend by yourself (last false). If it is in the include_path, you can try to change the last "false" into "true".
Posted by Graham Hensley (chiatar) on 2008-07-05T13:27:21.000+0000
Thanks Marty.
Everything looks good. However it still doesn't work. I don't know if this a product of my particular PHP install.
You added: // because lowercase will fail if (!$customFrontendNaming) { $frontend = self::_normalizeName($frontend); } if (!$customBackendNaming) { $backend = self::_normalizeName($backend); }
Only this works as desired for my installation
I tried casting the method variable as bool, this was the only comparison that worked.
Is this still an issue?
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:25.000+0000
Updating for the 1.6.0 release.