{"id":1550,"date":"2021-01-26T11:04:14","date_gmt":"2021-01-26T11:04:14","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/solved-array-and-string-offset-access-syntax-with-curly-braces-is-deprecated-in-magento-2\/"},"modified":"2025-05-22T11:09:11","modified_gmt":"2025-05-22T05:39:11","slug":"solved-array-and-string-offset-access-syntax-with-curly-braces-is-deprecated-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/solved-array-and-string-offset-access-syntax-with-curly-braces-is-deprecated-in-magento-2\/","title":{"rendered":"Solved: Array and String Offset Access Syntax With Curly Braces is Deprecated in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u201cThe way to succeed is to double your error rate!\u201d best quote of the day but not relevant for developers as glued errors are always frustrated in Magento 2, right?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Especially, it\u2019s so annoying when you don\u2019t know what\u2019s going on with your code, where\u2019s wrong and why it displays the error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ever been in this kind of situation? Ever faced an error that says,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1 exception(s):<br>Exception #0 (Exception): Deprecated Functionality: Array and string offset access syntax with curly braces is deprecated in \/vendor\/magento\/zendframework1\/library\/Zend\/Json\/Encoder.php on line 561<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To solve the above error of&nbsp;<em><strong>array and string offset access syntax with curly braces is deprecated in Magento 2<\/strong><\/em>, check the below solution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution For Array and String Offset Access Syntax With Curly Braces is Deprecated in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You just have to replace curly braces with square brackets in&nbsp;<strong>\/vendor\/magento\/zendframework1\/library\/Zend\/Json\/Decoder.php<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$utf8 .= $chrs{$i};<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace with,<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$utf8 .= $chrs[$i];<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In Encoder.php file of&nbsp;<strong>\/vendor\/magento\/zendframework1\/library\/Zend\/Json\/Encoder.php&nbsp;<\/strong>, replace curly braces with square brackets after every&nbsp;<strong>$utf8<\/strong>&nbsp;in&nbsp;<strong>_utf82utf16&nbsp;<\/strong>function.<br>i.e:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">chr(0x07 &amp; (ord($utf8{0}) >> 2))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace with,<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">chr(0x07 &amp; (ord($utf8[0]) >> 2))<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Solved!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the solution with Magento community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201cThe way to succeed is to double your error rate!\u201d best quote of the day but not relevant for developers as glued errors are always frustrated in Magento 2, right? Especially, it\u2019s so annoying when you don\u2019t know what\u2019s going on with your code, where\u2019s wrong and why it displays the error. Ever been in [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1550","post","type-post","status-publish","format-standard","hentry","category-magento"],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1550"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1550\/revisions"}],"predecessor-version":[{"id":14532,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1550\/revisions\/14532"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}