0

I've just upgraded to 2.3.3 from 2.3.2 however if I now try and edit a product it gives me this error in the browser:

An error has happened during application run. See exception log for details.

If I look in exception.log I can see these two lines:

[2019-11-03 18:29:18] temando.CRITICAL: "accountId" is required. Enter and try again. {"exception":"[object] (Magento\\Framework\\Exception\\InputException(code: 0): \"accountId\" is required. Enter and try again. at vendor/magento/framework/Exception/InputException.php:91)"} []
[2019-11-03 18:29:18] main.CRITICAL: Unable to serialize value. Error: Malformed UTF-8 characters, possibly incorrectly encoded {"exception":"[object] (InvalidArgumentException(code: 0): Unable to serialize value. Error: Malformed UTF-8 characters, possibly incorrectly encoded at vendor/magento/framework/Serialize/Serializer/Json.php:26)"} []

I've tried doing the usual flush cache, remove generated etc. I've also tried disabling modules but still can't find a solution.

I'm assuming that it's the unable to serialize value error but given it does it on every product and doesn't give any more info about the error I'm a bit stuck!

1 Answer 1

0

You have to fix in file: file/vendor/magento/framework/Serialize/Serializer/Json.php

Add into this code:

public function serialize($data)
{
    $result = json_encode($data);
    if (false === $result) {
        if(json_last_error() == JSON_ERROR_UTF8){
            $data = self::convert_from_latin1_to_utf8_recursively($data);
            $result = json_encode($data);
            if($result){
                return $result;
            }
        }
        throw new \InvalidArgumentException("Unable to serialize value. Error: " . json_last_error_msg());
    }
    return $result;
}
public static function convert_from_latin1_to_utf8_recursively($dat)
{
    if (is_string($dat)) {
        return utf8_encode($dat);
    } elseif (is_array($dat)) {
        $ret = [];
        foreach ($dat as $i => $d) $ret[ $i ] = self::convert_from_latin1_to_utf8_recursively($d);

        return $ret;
    } elseif (is_object($dat)) {
        foreach ($dat as $i => $d) $dat->$i = self::convert_from_latin1_to_utf8_recursively($d);

        return $dat;
    } else {
        return $dat;
    }
}

Reply me when you have the result.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.