Fix cache bug, the content of the cache was encoded in utf8 before
converting to json and saved, resulting in double-encoded caracters in output
This commit is contained in:
parent
f22b4b33df
commit
e59bf64c42
1 changed files with 3 additions and 3 deletions
|
@ -8,7 +8,7 @@ class FileCache extends CacheAbstract{
|
||||||
public function loadData(){
|
public function loadData(){
|
||||||
$this->isPrepareCache();
|
$this->isPrepareCache();
|
||||||
|
|
||||||
$datas = json_decode(file_get_contents($this->getCacheFile()),true);
|
$datas = unserialize(file_get_contents($this->getCacheFile()));
|
||||||
$items = array();
|
$items = array();
|
||||||
foreach($datas as $aData){
|
foreach($datas as $aData){
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
@ -25,9 +25,9 @@ class FileCache extends CacheAbstract{
|
||||||
$this->isPrepareCache();
|
$this->isPrepareCache();
|
||||||
|
|
||||||
//Re-encode datas to UTF-8
|
//Re-encode datas to UTF-8
|
||||||
$datas = Cache::utf8_encode_deep($datas);
|
//$datas = Cache::utf8_encode_deep($datas);
|
||||||
|
|
||||||
$writeStream = file_put_contents($this->getCacheFile(), json_encode($datas));
|
$writeStream = file_put_contents($this->getCacheFile(), serialize($datas));
|
||||||
|
|
||||||
if(!$writeStream) {
|
if(!$writeStream) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue