Author Topic: [] operator not supported for strings when visiting the basket php 7.1  (Read 642 times)

cmvrgr

  • Beginner
  • *
  • Posts: 12
  • A beginner
Hi, I am using  Joomla 3.9 and  VirtueMart 3.4.2 and I am using PHP PHP 7.0.33. Joomla displayed a message that I have to switch to a newer version for security reasons.

My hosting provider supports PHP 7.1.30, PHP 7.2.20, PHP 7.3.7. The major problem that exists is that when I am switching in either of the newer versions when I am visiting the shopping card I am getting an error message  "[] operator not supported for strings".

Is there a workaround to fix that?

Thanks

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2461
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Is it an error ? Or is it a warning?
Turn down error reporting. What extension gives the message?
Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

cmvrgr

  • Beginner
  • *
  • Posts: 12
  • A beginner
Re: [] operator not supported for strings when visiting the basket php 7.1
« Reply #2 on: August 07, 2019, 15:35:10 pm »
That message appears when going to cart. when switching back to the older unsuported PHP 7.0.33 it works fine.

[] operator not supported for strings
 
If problems persist, please contact the administrator of this site and report the error below

[] operator not supported for strings

StefanSTS

  • Global Moderator
  • Full Member
  • *
  • Posts: 520
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: [] operator not supported for strings when visiting the basket php 7.1
« Reply #3 on: August 07, 2019, 16:01:01 pm »
Are you using any special extensions for the cart?
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

cmvrgr

  • Beginner
  • *
  • Posts: 12
  • A beginner
Re: [] operator not supported for strings when visiting the basket php 7.1
« Reply #4 on: August 07, 2019, 16:07:15 pm »
No I am not. I tried also other template and also I have Layout Bootstrap version to None(legacy).

This is realy crazy. When moving to newer PHP PHP 7.1.30,    PHP 7.2.20,    PHP 7.3.7 stops working and get the operator not supported for stings message.

Only at PHP 7.0.33 works but joomla displays a message that this version is not supported by the creators and need to update to newer version.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9230
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: [] operator not supported for strings when visiting the basket php 7.1
« Reply #5 on: August 07, 2019, 16:17:25 pm »
you need to trace what is causing this error

plenty of info here:   http://forum.virtuemart.net/index.php?topic=117042.0
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

cmvrgr

  • Beginner
  • *
  • Posts: 12
  • A beginner
Re: [] operator not supported for strings when visiting the basket php 7.1
« Reply #6 on: August 07, 2019, 16:20:36 pm »
Thanks for the info

My template is Horme 3 free.

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3549
  • using Matomo instead of Google Analytics
Re: [] operator not supported for strings when visiting the basket php 7.1
« Reply #7 on: August 07, 2019, 19:32:40 pm »
I suppose the problem is this: https://www.php.net/manual/en/language.types.array.php
Creating/modifying with square bracket syntax ¶

An existing array can be modified by explicitly setting values in it.

This is done by assigning values to the array, specifying the key in brackets. The key can also be omitted, resulting in an empty pair of brackets ([]).

Code: [Select]
$arr[key] = value;
$arr[] = value;
// key may be an integer or string
// value may be any value of any type

If $arr doesn't exist yet, it will be created, so this is also an alternative way to create an array. This practice is however discouraged because if $arr already contains some value (e.g. string from request variable) then this value will stay in the place and [] may actually stand for string access operator. It is always better to initialize a variable by a direct assignment.

    Note: As of PHP 7.1.0, applying the empty index operator on a string throws a fatal error. Formerly, the string was silently converted to an array.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9230
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: [] operator not supported for strings when visiting the basket php 7.1
« Reply #8 on: August 08, 2019, 15:26:21 pm »
but he still needs to trace WHERE this is being called... 
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation