The error you got after your PHP version upgrade says it loud:
the []
operator not supported for strings.
You are probably trying to push an array into a string or something of that sort.
You would have gotten an Array to string conversion error should the string in question be empty (depending on your new PHP version and as well as defined error reporting level).
The []
operator not supported for strings error occurs when you are re-declaring a string as an array or attempting to use a string as if it were an array.
Take a look at the example below (resulting in the error you have):
$me = 'foo'; // $me is a variable holding a string value ('foo')
$me[] = 'bar'; // here, $me is re-declared as an array; an attempt to update $me with $me[]
How can you resolve this?
You simply have to re-declare your string variable just as such (still as a string variable; not as an array) for use should need be.
Take a close look at this:
$me = 'foo'; // with 'foo' as initial value when first declared
$me = 'bar'; // expected result on print_r($me) (successful, with no error): bar
Above, $me
was re-assigned a new string ('bar') as value successfully and without any error.
Also, do not attempt something funny like trying to still pushing in (into your string variable, whether re-declared or not) an array or else you will get the same error.
Instead, you may convert your string into array should you want to manipulate your values as such for the purpose you seek to achieve.
[]
operator not supported for strings in other words means the[]
operator, which happens to be the shorthand or short array syntax forarray()
as of PHP versions 5.4, cannot be used on strings.