Such behavior is described in Migrating from PHP 7.0.x to PHP 7.1.x/
The empty index operator is not supported for strings anymore Applying the empty index operator to a string (e.g. $str[] = $x) throws a fatal error instead of converting silently to array.
In my case it was a mere initialization. I fixed it by replacing $foo=''
with $foo=[]
.
$foo='';
$foo[]='test';
print_r($foo);