Zend Framework

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

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.10.6
  • Fix Version/s: 1.10.7
  • Component/s: Zend_Translate
  • Labels:
    None

Description

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

$options = array('cache' => Zend_Cache::factory(...));
$translator->setOptions($options);

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:

if ($key == 'cache') {
    self::setCache($options);
    continue;
}

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.

Activity

Hide
Thomas Weidner added a comment -

I agree... you misunderstood

Fixed with r22554

Show
Thomas Weidner added a comment - I agree... you misunderstood Fixed with r22554

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: