ZF-3582: Zend_Cache cannot have custom backend/frontend


The Zend_Cache controller has a bug which makes it impossible for a custom class to be used for the backend or frontend.


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


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.



sorry. typo fixed -chiatar

just fixed in SVN trunk (thanks)

can you try it ?

The syntax you have to use :

$cache=Zend_Cache::factory('Core','Project_Cache_Backend_MemcacheExt', array([...]), array([...]), false, true, false);

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".

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

    if ($customFrontendNaming != false) {
        $frontend = self::_normalizeName($frontend);
    if ($customBackendNaming !=false) {
        $backend  = self::_normalizeName($backend);

I tried casting the method variable as bool, this was the only comparison that worked.

Is this still an issue?

Updating for the 1.6.0 release.