ZF-2593: When using file backend for cache, the files will never be locked.

Description

Revision: 7826 Class: Zend_Cache_Backend_File Methods: _fileGetContents, _filePutContents Lines: 660, 668, 681, 683

In both methods flock() function is given parameters $f and $fp (??) that are nowhere declared, my guess they should be $file.

error-suppresion operator @ is successfully used to hide this error.

Comments

stupid error when refactoring the file backend, many thanks for the report, fixed in SVN trunk

Here's what i get now:

Debug Warning: \home...\lib\Zend\Cache\Backend\File.php line 660 - flock() expects parameter 1 to be resource, string given Debug Warning: \home...\lib\Zend\Cache\Backend\File.php line 668 - flock() expects parameter 1 to be resource, string given Debug Warning: \home...\lib\Zend\Cache\Backend\File.php line 681 - flock() expects parameter 1 to be resource, string given Debug Warning: \home...\lib\Zend\Cache\Backend\File.php line 683 - flock() expects parameter 1 to be resource, string given

I guess you'll have to fopen it

Also, maybe when testing, remove @ to see errors :)

oooops...

thanks, I hope it's fixed in SVN trunk now

Somehow cache file with size 0 was created, and when it was attempted to be read by _fileGetContents it gave an error in $result = fread($f, $fsize); - apparently fread can't have $fsize==0

fixed in SVN trunk, thanks Moshe