cancel
Showing results for 
Search instead for 
Did you mean: 

Deprecated Functionality: Array and string offset access syntax with curly braces is deprecated

Deprecated Functionality: Array and string offset access syntax with curly braces is deprecated

I'm trying to update Magento 2.3 to 2.4 and when i run setup:di:compile i get this error:

  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

 I know that the issue is caused by php 7.4 that doesn't allow use of curly braces but i don't know how to resolve it. I tried to use php 7.3 but the console doesn't run commands.

Anyone can help?

1 REPLY 1

Re: Deprecated Functionality: Array and string offset access syntax with curly braces is deprecate

This is the code at line 49 in fieldfactory.php

 

//check if type ends with []
if ($fieldType{strlen($fieldType) - 2} == '[' && $fieldType{strlen($fieldType) - 1} == ']') {
$isList = true;
$fieldData['type'] = str_replace('[]', '', $fieldData['type']);
$fieldData['itemType'] = str_replace('[]', '', $fieldData['type']);