ZF-10140: In Zend_Translate->setOptions, tries to set entire options array as cache object

Issue Type: Bug Created: 2010-07-12T08:42:42.000+0000 Last Updated: 2010-07-12T10:58:51.000+0000 Status: Resolved Fix version(s): - 1.10.7 (28/Jul/10)

Reporter: Adam Plumb (adamplumb) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

Related issues: Attachments:


If I add a cache object to my Zend_Translate options, like so:

<pre class="highlight">
$options = array('cache' => Zend_Cache::factory(...));

This leads to the following error:

Catchable fatal error: Argument 1 passed to Zend_Translate_Adapter::setCache() must be an instance of Zend_Cache_Core, array given, called in /usr/local/zend/share/ZendFramework/library/Zend/Translate/Adapter.php on line 335 and defined in /usr/local/zend/share/ZendFramework/library/Zend/Translate/Adapter.php on line 885

Looking in Translate/Adapter.php line 335, I found the problem:

<pre class="highlight">
if ($key == 'cache') {

I may be misunderstanding something, but you should be sending $option to setCache, not $options, which is the entire $options array.

If I change it to $option, everything works as expected.


Posted by Thomas Weidner (thomas) on 2010-07-12T10:58:49.000+0000

I agree... you misunderstood :p

Fixed with r22554

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.