开发交流

ecshop 专题添加商品不显示BUG(编码差异引起unserialize函数长度计算错误)

LYECS,LYECS+商城系统,多用户商城系统,开源商城系统 发布日期:2016-01-15   作者:老杨


偶然遇到客户有添加专题商品,编辑完后就不显示了的问题,

ecshop 专题添加商品不显示BUG(编码差异引起unserialize函数长度计算错误)

1、文件admin/topic.php

找到:
        $topic['data'] = addcslashes($topic['data'], "'");
        $topic['data'] = $json->encode(@unserialize($topic['data']));
        $topic['data'] = addcslashes($topic['data'], "'");

替换为:

        $topic['data']= preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $topic['data'] );
        $topic['data']= str_replace("\r", "",$topic['data']);   
        $topic['data'] = addcslashes($topic['data'], "'");
        $topic['data'] = $json->encode(@unserialize($topic['data']));
        $topic['data'] = addcslashes($topic['data'], "'");


2、找到topic.php
找到:

$topic['data'] = addcslashes($topic['data'], "'");

替换为:


    $topic['data']= preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $topic['data'] );
    $topic['data']= str_replace("\r", "",$topic['data']);   
    $topic['data'] = addcslashes($topic['data'], "'");

热门文章

分类标签