Question

I am getting Bellow Error when i try to search default Magento search https://temp.com/catalogsearch/result/?q=Hiper

Unable to unserialize value. Error: Control character error, possibly incorrectly encoded

Error Log:

{"0":"Unable to unserialize value. Error: Control character error, possibly incorrectly encoded","1":"#1 Magento\Framework\View\Layout->generateElements() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:89]\n#2 Magento\Framework\View\Layout\Interceptor->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]\n#3 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:55]\n#4 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]\n#5 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Page/Config.php:208]\n#6 Magento\Framework\View\Page\Config->build() called at [vendor/magento/framework/View/Page/Config.php:218]\n#7 Magento\Framework\View\Page\Config->publicBuild() called at [vendor/magento/framework/App/View.php:170]\n#8 Magento\Framework\App\View->loadLayoutUpdates() called at [vendor/magento/framework/App/View.php:114]\n#9 Magento\Framework\App\View->loadLayout() called at [vendor/magento/module-catalog-search/Controller/Result/Index.php:119]\n#10 Magento\CatalogSearch\Controller\Result\Index->getCacheableResult(&Magento\CatalogSearch\Helper\Data#000000006a20343000000000593f6e54#, &Magento\Search\Model\Query#000000006a20342000000000593f6e54#) called at [vendor/magento/module-catalog-search/Controller/Result/Index.php:91]\n#11 Magento\CatalogSearch\Controller\Result\Index->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]\n#12 Magento\CatalogSearch\Controller\Result\Index\Interceptor->___callParent('execute', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]\n#13 Magento\CatalogSearch\Controller\Result\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [app/code/Zemez/AjaxCatalog/Plugin/CatalogSearch/Result.php:34]\n#14 Zemez\AjaxCatalog\Plugin\CatalogSearch\Result->aroundExecute(&Magento\CatalogSearch\Controller\Result\Index\Interceptor#000000006a20351000000000593f6e54#, &Closure#000000006a20343d00000000593f6e54#) called at [vendor/magento/framework/Interception/Interceptor.php:135]\n#15 Magento\CatalogSearch\Controller\Result\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]\n#16 Magento\CatalogSearch\Controller\Result\Index\Interceptor->___callPlugins('execute', array(), NULL) called at [generated/code/Magento/CatalogSearch/Controller/Result/Index/Interceptor.php:26]\n#17 Magento\CatalogSearch\Controller\Result\Index\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:107]\n#18 Magento\Framework\App\Action\Action->dispatch(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/Interception/Interceptor.php:58]\n#19 Magento\CatalogSearch\Controller\Result\Index\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]\n#20 Magento\CatalogSearch\Controller\Result\Index\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [app/code/Bss/Paymentshipping/Plugin/App/Action/Context.php:81]\n#21 Bss\Paymentshipping\Plugin\App\Action\Context->aroundDispatch(&Magento\CatalogSearch\Controller\Result\Index\Interceptor#000000006a20351000000000593f6e54#, &Closure#000000006a20351300000000593f6e54#, &Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/Interception/Interceptor.php:135]\n#22 Magento\CatalogSearch\Controller\Result\Index\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/Interception/Interceptor.php:153]\n#23 Magento\CatalogSearch\Controller\Result\Index\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#), NULL) called at [generated/code/Magento/CatalogSearch/Controller/Result/Index/Interceptor.php:39]\n#24 Magento\CatalogSearch\Controller\Result\Index\Interceptor->dispatch(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/App/FrontController.php:55]\n#25 Magento\Framework\App\FrontController->dispatch(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/Interception/Interceptor.php:58]\n#26 Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]\n#27 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:94]\n#28 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#000000006a2036ae00000000593f6e54#, &Closure#000000006a2036a600000000593f6e54#, &Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/Interception/Interceptor.php:135]\n#29 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:73]\n#30 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#000000006a2036ae00000000593f6e54#, &Closure#000000006a2036a600000000593f6e54#, &Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [app/code/Zemez/SiteMaintenance/Model/PageCache/App/FrontController/BuiltinPlugin.php:30]\n#31 Zemez\SiteMaintenance\Model\PageCache\App\FrontController\BuiltinPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#000000006a2036ae00000000593f6e54#, &Closure#000000006a2036a600000000593f6e54#, &Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/Interception/Interceptor.php:135]\n#32 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/Interception/Interceptor.php:153]\n#33 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#), NULL) called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]\n#34 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#000000006a20377800000000593f6e54#) called at [vendor/magento/framework/App/Http.php:136]\n#35 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]\n#36 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:257]\n#37 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000006a20373600000000593f6e54#) called at [index.php:41]\n</pre>","url":"/catalogsearch/result/?q=hyperline","script_name":"/index.php"}

Magento version 2.2.8

any one have idea how to fixed it ?

Was it helpful?

Solution

I solve this issue by flushing my Redis Cache from by running following commands

redis-cli 
flushall

I hope this works.

EDIT

try this https://www.scommerce-mage.com/blog/solved-unable-to-unserialize-value-magento-2.html

OTHER TIPS

Go to this file location and paste below code and best way try to override this file : /vendor/magento/framework/Serialize/Serializer/Json.php

public function utf8ize( $mixed ) {
    if (is_array($mixed)) foreach ($mixed as $key => $value) $mixed[$key] = $this->utf8ize($value);
    elseif (is_string($mixed)) return mb_convert_encoding($mixed, "UTF-8", "UTF-8");
    return $mixed;
}

public function serialize($data){
    $result = json_encode( $this->utf8ize( $data ) );
    if (false === $result) {
        throw new \InvalidArgumentException("Unable to serialize value. Error: " . json_last_error_msg());
    }
    return $result;
}

How to override this file

The preference for the SerializerInterface was added since 2.2.x version of the Magento, and declared in the app/etc/di.xml:

<preference for="Magento\Framework\Serialize\SerializerInterface" type="Magento\Framework\Serialize\Serializer\Json" />

Override Hint

Then create the class [Vendor][Module]\Serialize\Serializer\Json that extends Magento\Framework\Serialize\Serializer\Json and make your changes in there.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top