微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

部署magento 2.3时,public_html / vendor / magento / framework / Serialize / Serializer / Json.php上出现错误

如何解决部署magento 2.3时,public_html / vendor / magento / framework / Serialize / Serializer / Json.php上出现错误

我从备份中上传了magento文件数据库,我是从同一服务的其他旧帐户中获取的,并且所有文件均已完成并且服务器帐户具有相同的配置 但是当我尝试部署它时,它给了我那个错误 在前端

致命错误:未捕获invalidargumentexception:无法反序列化值。错误:格式错误的UTF-8字符,可能在/home/u922728750/domains/6alabaty.com/public_html/vendor/magento/framework/Serialize/Serializer/Json.PHP:39中编码错误,堆栈跟踪:#0 / home / u922728750 / domains / 6alabaty.com / public_html / vendor / magento / framework / Interception / Config / CacheManager.PHP(69):Magento \ Framework \ Serialize \ Serializer \ Json-> unserialize('{“ Magento \\ Stor ...') #1 /home/u922728750/domains/6alabaty.com/public_html/vendor/magento/framework/Interception/Config/Config.PHP(118):Magento\Framework\Interception\Config\CacheManager->load('interception')# 2 /home/u922728750/domains/6alabaty.com/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.PHP(121):Magento\Framework\Intercept\Config\Config-> __ construct(Object(Magento \ Framework \ / home /中的ObjectManager \ Config \ Reader \ Dom \ Proxy),Object(Magento \ Framework \ Config \ Scope),Object(Magento \ Framework \ App \ Cache \ Type \ Config),Object(Magento \ Framework \ ObjectManager \ Relati在/ home / u922728750 / domains / 6alabaty.com /第39行的public_html / vendor / magento / framework / Serialize / Serializer / Json.PHP

并且jason文件代码

<?PHP
/**
 * copyright © Magento,Inc. All rights reserved.
 * See copYING.txt for license details.
 */
namespace Magento\Framework\Serialize\Serializer;

use Magento\Framework\Serialize\SerializerInterface;

/**
 * Serialize data to JSON,unserialize JSON encoded data
 *
 * @api
 * @since 101.0.0
 */
class Json implements SerializerInterface
{
    /**
     * @inheritDoc
     * @since 101.0.0
     */
    public function serialize($data)
    {
        $result = json_encode($data);
        if (false === $result) {
            throw new \invalidargumentexception("Unable to serialize value. Error: " . json_last_error_msg());
        }
        return $result;
    }

    /**
     * @inheritDoc
     * @since 101.0.0
     */
    public function unserialize($string)
    {
        $result = json_decode($string,true);
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \invalidargumentexception("Unable to unserialize value. Error: " . json_last_error_msg());
        }
        return $result;
    }
}

我尝试了很多解决方案,但所有解决方案都无法正常工作,请帮助我

解决方法

看起来像magento试图json_decode一些不是utf8的字符串。 json标准需要utf8。

看起来正在读取一些配置数据?也许某些配置文件中包含非utf8?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。