Solved: Array and String Offset Access Syntax With Curly Braces is Deprecated in Magento 2
“The way to succeed is to double your error rate!” best quote of the day but not relevant for developers as glued errors are always frustrated in Magento 2, right?
Especially, it’s so annoying when you don’t know what’s going on with your code, where’s wrong and why it displays the error.
Ever been in this kind of situation? Ever faced an error that says,
1 exception(s):
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
To solve the above error of array and string offset access syntax with curly braces is deprecated in Magento 2, check the below solution.
Solution For Array and String Offset Access Syntax With Curly Braces is Deprecated in Magento 2
You just have to replace curly braces with square brackets in /vendor/magento/zendframework1/library/Zend/Json/Decoder.php
1 |
$utf8 .= $chrs{$i}; |
Replace with,
1 |
$utf8 .= $chrs[$i]; |
In Encoder.php file of /vendor/magento/zendframework1/library/Zend/Json/Encoder.php , replace curly braces with square brackets after every $utf8 in _utf82utf16 function.
i.e:
1 |
chr(0x07 & (ord($utf8{0}) >> 2)) |
Replace with,
1 |
chr(0x07 & (ord($utf8[0]) >> 2)) |
Solved!
If you have any doubts, just mention them in the Comments section below 🙂 I would be happy to help.
Feel free to share the solution with Magento community via social media.
Thank you.
6 Comments
Ya Its Working
Thank You!!
Hi i have similar issue but in different file:
Deprecated Functionality: Array and string offset access syntax with curly braces is deprecated in /public_html/vendor/magento/framework/GraphQl/Config/Element/FieldFactory.php on line 49
Can you help with this?
Thanks
Ya Sure, so for that you need to go to the file in which you are facing issue and
replace curly braces with square brackets that’s it!
If still the error continues please do let us know.
It works. Thanks for sharing this!!
Hello Kirby,
We’re glad to know that our solution is helpful for you.
Thank You