cancel
Showing results for 
Search instead for 
Did you mean: 

The problem for "There has been an error processing your request" on Magento2

The problem for "There has been an error processing your request" on Magento2

Dear Sirs,

 

When we update the product details , we find our website shows the following errors. Could you help me to solve the problem ??

 

{"0":"Unable to serialize value. Error: Malformed UTF-8 characters, possibly incorrectly encoded","1":"<pre>#1 Magento\\Framework\\App\\PageCache\\Kernel->process(&Magento\\Framework\\App\\Response\\Http\\Interceptor#00000000258684da000000005c486028#) called at [vendor\/magento\/module-page-cache\/Model\/Controller\/Result\/BuiltinPlugin.php:96]\n#2 Magento\\PageCache\\Model\\Controller\\Result\\BuiltinPlugin->afterRenderResult(&Magento\\Framework\\View\\Result\\Page\\Interceptor#0000000025868014000000005c486028#, &Magento\\Framework\\View\\Result\\Page\\Interceptor#0000000025868014000000005c486028#, &Magento\\Framework\\App\\Response\\Http\\Interceptor#00000000258684da000000005c486028#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:146]\n#3 Magento\\Framework\\View\\Result\\Page\\Interceptor->Magento\\Framework\\Interception\\{closure}(&Magento\\Framework\\App\\Response\\Http\\Interceptor#00000000258684da000000005c486028#) called at [vendor\/magento\/framework\/Interception\/Interceptor.php:153]\n#4 Magento\\Framework\\View\\Result\\Page\\Interceptor->___callPlugins('renderResult', array(&Magento\\Framework\\App\\Response\\Http\\Interceptor#00000000258684da000000005c486028#), NULL) called at [generated\/code\/Magento\/Framework\/View\/Result\/Page\/Interceptor.php:130]\n#5 Magento\\Framework\\View\\Result\\Page\\Interceptor->renderResult(&Magento\\Framework\\App\\Response\\Http\\Interceptor#00000000258684da000000005c486028#) called at [vendor\/magento\/framework\/App\/Http.php:141]\n#6 Magento\\Framework\\App\\Http->launch() called at [generated\/code\/Magento\/Framework\/App\/Http\/Interceptor.php:24]\n#7 Magento\\Framework\\App\\Http\\Interceptor->launch() called at [vendor\/magento\/framework\/App\/Bootstrap.php:261]\n#8 Magento\\Framework\\App\\Bootstrap->run(&Magento\\Framework\\App\\Http\\Interceptor#00000000258684d3000000005c486028#) called at [index.php:39]\n<\/pre>","url":"\/","script_name":"\/index.php"}

3 REPLIES 3

Re: The problem for "There has been an error processing your request" on Magento2

@alex_chang1 

 

Correct your file
..vendor/magento/framework/Serialize/Serializer/Json.php

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(utf8ize($data));
        if (false === $result) {
            throw new \InvalidArgumentException("Unable to serialize value2. 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;
    }
    
}


function utf8ize( $mixed ) {
    if (is_array($mixed)) {
        foreach ($mixed as $key => $value) {
            $mixed[$key] = utf8ize($value);
        }
    } elseif (is_string($mixed)) {
        return mb_convert_encoding($mixed, "UTF-8", "UTF-8");
    }
    return $mixed;
}
        
Manish Mittal
https://www.manishmittal.com/

Re: The problem for "There has been an error processing your request" on Magento2

Hi @alex_chang1 

Kindly refer below link:

https://magento.stackexchange.com/questions/202448/magento-2-2-1-unable-to-serialize-value

https://community.magento.com/t5/Magento-2-x-Version-Upgrades/Unable-to-serialize-value-Magento-2-2-...

It will help you to resolve issues.

If issues resolve, Please click on 'Kudos' & Accept as Solution!

Problem solved? Click Accept as Solution!

Re: The problem for "There has been an error processing your request" on Magento2

The problem is not solved. 

We remember we are using "configurable products" , after that , we get this error.