ZF-10682: Undefined offset: 0 Notice in Zend_Cache_Frontend_File

Issue Type: Bug Created: 2010-11-13T18:17:46.000+0000 Last Updated: 2010-11-14T12:25:41.000+0000 Status: Closed Fix version(s): - 1.11.1 (30/Nov/10)

Reporter: Piotr Pisera (progpis) Assignee: Marc Bennewitz (private) (mabe) Tags: - Zend_Cache

Related issues: Attachments:


PHP Notice is being reported in Zend_Cache_Frontend_File and 'master_file' option left blank if 'master_files' options array has non-numeric indexes, or if index 0 (zero) does not exist. This occurs when a string-indexed array is being given as the third argument to Zend_Cache::factory() or when using cache manager XML config, for instance:

my_file.xml (...)

Affects all versions, including trunk.

How to reproduce:

array( 'my\_file' => 'my\_file.xml', ), ), array() ); ?> $ php test.php PHP Notice: Undefined offset: 0 in Zend/Cache/Frontend/File.php on line 107


replace Zend/Cache/Frontend/File.php line 107:

$this->_specificOptions['master_file'] = $masterFiles[0]; // to keep a compatibility


$this->_specificOptions['master_file'] = reset($masterFiles); // to keep a compatibility


Posted by Marc Bennewitz (private) (mabe) on 2010-11-14T08:39:08.000+0000

Thank you for your report.

fixed in r23329 (trunk) - can you please test it again before I'll commit to 1.11 branch


Posted by Piotr Pisera (progpis) on 2010-11-14T09:37:38.000+0000

Thanks for looking into it. The notice is gone and the trunk version seems to work as expected.

Posted by Marc Bennewitz (private) (mabe) on 2010-11-14T12:10:35.000+0000

fixed in r23329 (trunk) and r23330 (1.11 branch)

Posted by Ramon Henrique Ornelas (ramon) on 2010-11-14T12:25:39.000+0000

Hi mabe

I think that have of typo in line 122. Current code:

<pre class="highlight">
$this->_specificOptions['master_files'] = $masterFile;

Should be:

<pre class="highlight">
$this->_specificOptions['master_file'] = $masterFile;

Thanks advance Ramon

Have you found an issue?

See the Overview section for more details.


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

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