Magento 2:如何在尝试序列化结帐配置时找到导致错误

我在 Magneto 2.3.4 上。里面有vendor/magento/module-checkout/view/frontend/templates/onepage.phtml这样一行:

        window.checkoutConfig = <?= /* @noEscape */ $block->getSerializedCheckoutConfig() ?>;

按照功能,它归结为vendor/magento/module-checkout/Block/Onepage.php::getSerializedCheckoutConfig()

并且序列化功能在vendor/magento/framework/Serialize/Serializer/JsonHexTag.php

我添加json_last_error_msg()到异常消息中,基本上现在的错误消息是:

Exception #0 (InvalidArgumentException): Unable to serialize value. Error:Malformed UTF-8 characters, possibly incorrectly encoded

如何快速找到包含错误 UTF-8 字符的结帐配置值或键?或者如何在数据库中快速解决这个问题?


蝴蝶刀刀
浏览 101回答 1
1回答

月关宝盒

由于 Magento StackExchange 上的建议,我能够调试并找到有问题的字符。https://magento.stackexchange.com/questions/305931/magento-2-how-to-find-which-config-causing-error-malformed-utf-8-characters-p基本上使用 XDebug 来调试使用 utf8 检查处理的键和值:mb_detect_encoding($suspiciousString,&nbsp;'UTF-8',&nbsp;true)原来是一个错误的加密密钥,我将一些凭据解密为格式错误的字符
打开App,查看更多内容
随时随地看视频慕课网APP