ZF-3582: Zend_Cache cannot have custom backend/frontend

Issue Type: Bug Created: 2008-07-04T18:05:46.000+0000 Last Updated: 2008-09-02T10:39:25.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Graham Hensley (chiatar) Assignee: Fabien MARTY (fab) Tags: - Zend_Cache

Related issues: Attachments:


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.



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 :

<pre class="highlight">
$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".

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

    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?

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:25.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.