Sorry, but on the first look this seems to be a cache problem and not a translation one. Looking at the lines you provide I see that at line 435 the cache is loaded...
$result = self::$_cache->load($id);
which happens without problems.

And then the cache is unserialized.
unserialize($result);
All translate classes are serializing the data before writing to cache so this can not be a problem.

In my opinion there are only 4 things which can corrupt this behaviour.

1.) You are using an outdated cache after an update of ZF
2.) Someone writes manually to the translation cache without serializing the data
3.) Someone uses own written adapter which corrupt the cache
4.) You have a corrupted ZF version... try a update to fix the broken files

Of course it could be that there is a problem in Zend_Cache itself, but I dont believe this, because your problem is thrown in unserialize. Why should Zend_Cache change the stored data. And Zend_Translate stores only serialized strings.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message ----- From: "kirpit" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, November 20, 2008 5:41 AM
Subject: [fw-general] $cache->start() and caching with Zend_Translate together, possible bug?


Hi ZF people.

I have following lines in bootstrap with ZF v1.7 running on php 5.2.6:

---------------------------------------->

$cache = Zend_Cache::factory('Page', 'File', array(
'lifetime' => 60 * 60 * 12,
'regexps' => array(
 // cache whole indexController
 '^' . BASE_PATH . '$' => array(
 'cache' => true),
 // cache whole indexController
 '^' . BASE_PATH . 'index' => array(
 'cache' => true),
 // cache whole iController
 '^' . BASE_PATH . 'i/' => array(
 'cache' => true),
 // cache ajax/get-suggest
 '^' . BASE_PATH . 'ajax/get-suggest' => array(
 'cache' => true,
 'cache_with_get_variables' => true,
 'cache_with_session_variables' => true,
 'cache_with_cookie_variables' => true,
 'make_id_with_get_variables' => true,
 'make_id_with_session_variables' => false,
 'make_id_with_cookie_variables' => false))), array(
'cache_dir' => TEMP_DIR));
$cache->start();

// ... more later

Zend_Translate::setCache($cache);
$translate = new Zend_Translate('csv', DOC_ROOT . 'language' . DS .
'tr_TR.csv', 'tr_TR');
Zend_Registry::set('Zend_Translate', $translate);

---------------------------------------->

And it produces following errors:

Warning: unserialize() expects parameter 1 to be string, array given in
...\Zend\Translate\Adapter.php on line 436

Notice: No translation for the language 'tr_TR' available. in
...\Zend\Translate\Adapter.php on line 307

Notice: No translation for the language 'tr_TR' available. in
...\Zend\Translate\Adapter.php on line 307

Notice: No translation for the language 'tr_TR' available. in
...\Zend\Translate\Adapter.php on line 307

When I comment one of the cache feature, either $cache->start()
or Zend_Translate::setCache($cache); everything looks fine. I have found
similar bug below link but it says it is fixed already:
http://framework.zend.com/issues/browse/ZF-3930

Could be a bug?


Reply via email to