cancel
Showing results for 
Search instead for 
Did you mean: 

Deprecated Functionality: when runing compile

Deprecated Functionality: when runing compile

Hi all

I have two Magento sites both v2.3.3

I have noticed today that I cannot run the compile function:

php -dmemory_limit=4G bin/magento setup:di:compile

I'm getting the following error:

Application code generator... 3/7 [=====>-------]  42% 18 secs 254.0 MiB
In ErrorHandler.php line 61:

  Deprecated Functionality: Array and string offset access syntax with curly
  braces is deprecated in /home/customer/www/mystagingsite.com/public_html/
  vendor/magento/framework/GraphQl/Config/Element/FieldFactory.php on line 49

I have no idea why or what has caused this.

Has anyone else experienced the same and what is the issue/solution please?

PS. I changed the curly brackets in the file from { } to [ ] on line 49 of the mentioned file but then got the following error:

Application code generator... 3/7 [=====>-------]  42% 20 secs 272.0 MiB
In ErrorHandler.php line 61:

  Deprecated Functionality: Unparenthesized `a ? b : c ?: d` is deprecated. U
  se either `(a ? b : c) ?: d` or `a ? b : (c ?: d)` in /home/customer/www/mystagingsite.com/public_html/vendor/magento/framework-message-queue/BatchC
  onsumer.php on line 154

This is so odd.

Please help if you can

Andy

5 REPLIES 5

Re: Deprecated Functionality: when runing compile

@Andy_Acute 

Which php version you are using?

This issue arrives in php 7.4 version.

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Deprecated Functionality: when runing compile

Hi Sanjay

Thank you for replying.

My hosting server automatically upgraded php to version 7.4

I have now changed this to 7.3 using their admin dashboard.

Using phpinfo.php it states the php version as 7.3.28

But I still get the compile error.

Any ideas?

Many Thanks

Andy

Re: Deprecated Functionality: when runing compile

Hi Sanjay

 

Update:
My hosting company has set php 7.4 as the default so to access v 7.3 when running scripts I had to specify the php version - /usr/local/php73/bin/php-cli

Hope this helps others.

Re: Deprecated Functionality: when runing compile

Let's say, Something like this in your code:

$str = "test";

echo ($str{0});

So please change the above code with this...

$str = "test";

echo ($str[0]);

 

Still, you are facing an issue please follow the below link maybe it can help you

 

https://stackoverflow.com/questions/61432488/php-error-unparenthesized-a-b-c-d-e-is-deprecated-use-e...

Re: Deprecated Functionality: when runing compile

Hi, i'm facing this issue, did u solve it?