zend-frameworkzend-cache

Zend framework caching encoding


I'm developing a Zend application. It caches menu items to reduce database transactions. I'm looking for a way to set encoding of cached files to UTF8. In application.ini I have:

resources.view.encoding = "UTF-8"

Though seems not working.

Update:

I can't find _initCache function or any other code responsible of caching. Caching is only specified in application.ini :

resources.cache.frontEnd = core
resources.cache.backEnd = file
resources.cache.frontEndOptions.lifetime = 1200
resources.cache.frontEndOptions.automatic_serialization = true
resources.cache.backEndOptions.lifetime = 3600
resources.cache.backEndOptions.cache_dir = APPLICATION_PATH "/../cache"
pluginPaths.CMS_Application_Resource   = APPLICATION_PATH "/../library/CMS/Application/Resource" 

Solution

  • I'm looking for a way to set encoding of cached files to UTF8

    Zend_Cache doesn't have an encoding option and doesn't handle encodings! Zend_Cache simply stores data as a binary stream so if you store UTF-8 text you store a byte stream and if you store ASCII text you store a byte stream. YOU have to know which type of data you stored within the cache and how to use it. If you don't have magic_quote_runtime enabled you get the same bytes you stored before else disable this deprecated PHP-INI-Setting (and all other magic quotes settings).