When i launch a REST API call to see all orders on my site i get this error:
main.CRITICAL: Report ID: webapi-62432e964b1e4; Message: Unable to unserialize value. {"exception":"[object] (Exception(code: 0): Report ID: webapi-62432e964b1e4; Message: Unable to unserialize value. at /httpdocs/lib/internal/Magento/Framework/Webapi/ErrorProcessor.php:208, InvalidArgumentException(code: 0): Unable to unserialize value. at /httpdocs/lib/internal/Magento/Framework/Serialize/Serializer/Json.php:44)"} []
I search on google and i found several solution like this :
Magento 2.2: Unable to unserialize value?
i tried to change the file in lib/internal/Magento/Framework/Serialize/Serializer/Json.php:
public function unserialize($string)
{
if($this->is_serialized($string))
{
$string = $this->serialize($string);
}
$result = json_decode($string, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new InvalidArgumentException('Unable to unserialize value.');
}
return $result;
}
function is_serialized($value, &$result = null)
{
// Bit of a give away this one
if (!is_string($value))
{
return false;
}
// Serialized false, return true. unserialize() returns false on an
// invalid string or it could return false if the string is serialized
// false, eliminate that possibility.
if ($value === 'b:0;')
{
$result = false;
return true;
}
$length = strlen($value);
$end = '';
switch ($value[0])
{
case 's':
if ($value[$length - 2] !== '"')
{
return false;
}
case 'b':
case 'i':
case 'd':
// This looks odd but it is quicker than isset()ing
$end .= ';';
case 'a':
case 'O':
$end .= '}';
if ($value[1] !== ':')
{
return false;
}
switch ($value[2])
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
break;
default:
return false;
}
case 'N':
$end .= ';';
if ($value[$length - 1] !== $end[0])
{
return false;
}
break;
default:
return false;
}
if (($result = @unserialize($value)) === false)
{
$result = null;
return false;
}
return true;
}
But keep giving me this error, can someone help me?
I have magento 2.4.3 and PHP 7.4.28.