How to fix the «Error filtering template: Unable to unserialize value» Magento 2.2 failure of a CMS widget rendering?

bug
cms-block
cms-widget
magento22

(Dmitry Fedyuk) #1

Error filtering template: Unable to unserialize value.


(Dmitry Fedyuk) #2

Magento\Framework\Serialize\Serializer\Json::unserialize()

My $string is:

[“1”:[“type”:“Magento\CatalogWidget\Model\Rule\Condition\Combine”,“aggregator”:“all”,“value”:“1”,“new_child”:""],“1–1”:[“type”:“Magento\CatalogWidget\Model\Rule\Condition\Product”,“attribute”:“category_ids”,“operator”:"==",“value”:“6”]]

The string is from the content column of the cms_block table:

<...>
<div class="content-heading">
   <h2 class="title">Hot Sellers</h2>
   <p class="info">Here is what`s trending on Luma right now</p>
</div>
{{widget type="Magento\CatalogWidget\Block\Product\ProductsList" products_per_page="8" products_count="8" template="product/widget/content/grid.phtml" conditions_encoded="[`1`:[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`,`aggregator`:`all`,`value`:`1`,`new_child`:``],`1--1`:[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`,`attribute`:`sku`,`operator`:`()`,`value`:`WS12, WT09, MT07, MH07, 24-MB02, 24-WB04, 241-MB08, 240-LV05`]]"}}

(Dmitry Fedyuk) #3

I have fixed the problem by resaving the problem content pages / blocks in the backend: it forced Magento 2 to convert the problem widgets to the new format.


(Dmitry Fedyuk) #4

Another solution: How to fix the «Unable to unserialize value» failure while upgrading Magento from 2.1.x to 2.2.x?