ZF-7111: Zend_Cache backward incompatible change

Issue Type: Bug Created: 2009-06-23T23:08:06.000+0000 Last Updated: 2009-09-18T11:19:07.000+0000 Status: Resolved Fix version(s): Reporter: Farzad Ghanei (farzadghanei) Assignee: Pádraic Brady (padraic) Tags: - Zend_Cache

Related issues: Attachments:


I've been using ZF 1.8.1 for a project, today I installed the 1.8.4 release and then my application failed to start. I'm using a cache resource in my application, and I've been using the static method Zend_Cache_Backend_File::getTmpDir() to find the path to temp directory, but after the upgrade I have this exception:

Fatal error: Call to undefined method Application_Resource_Cache::_isGoodTmpDir() in /usr/share/php/Zend/Cache/Backend.php on line 177

I inspected the Zend Framework code and found out that in 1.8.1 release, the getTmpDir() was static method (as I've used it in my code), but in 1.8.4 this method is no longer static, and is calling the _isGoodTmpDir() member method. I read the release notes of 1.8.2, 1.8.3 and 1.8.4 before this upgrade and there was no mention in changing Zend_Cache API.

is it a permanent choice to make this method an instance method? because I'm using the getTmpDir() to configure settings of my cache object, before creating it. here is my code:

<pre class="highlight">
           if ( $backend['adapter'] == 'File' ) {
                $cachePath = realpath( Zend_Cache_Backend_File::getTmpDir() );
                if ( isset($backendOptions['cache_dir']) ) {
                    $cachePath = realpath( (string)$backendOptions['cache_dir'] );
                    if ( !$cachePath || !file_exists($cachePath) || !is_dir($cachePath) || !is_readable($cachePath) || !is_writable($cachePath) ) {
                        throw new Exception('cache_dir is not a valid readable/writable directory. check application configurations.');
                $backendOptions['cache_dir'] = $cachePath;
            $this->_cache = Zend_Cache::factory($frontend['adapter'], $backend['adapter'], $frontendOptions, $backendOptions);

so , if this method will not be static, I should first create a dummy Zend_Cache object, and then use this method to find out temp directory for my real cache object. I think static approach was better.


Posted by Fabien MARTY (fab) on 2009-06-24T09:23:08.000+0000

you are right but if you don't set a cache_dir the call to getTmpDir() is automatic

so your piece of code is useless, isn't it ?

Posted by Farzad Ghanei (farzadghanei) on 2009-06-26T03:32:38.000+0000

yep! all my path validation and stuff are automatically done in Zend_Cache object. thanks for clearing me out.

Posted by Fabien MARTY (fab) on 2009-07-17T11:03:37.000+0000

change Assignee because I'm inactive now

Posted by Satoru Yoshida (satoruyoshida) on 2009-08-31T04:54:28.000+0000

Is this issue still active now?

Posted by Pádraic Brady (padraic) on 2009-09-18T11:19:07.000+0000

Issue was in how user used the component, or a refactored/unintentionally public piece of internal functionality. Not an issue for resolution within the source code.

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.