Greetings, There is something weird with 7.1 and implicit strings to array conversions, so I wanted to double check with you that the behaviour is wanted (and perhaps the migration71 doc should be updated to reflect this.
So in the migration docs [1] you say that: " Applying the empty index operator to a string (e.g. $str[] = $x) throws a fatal error instead of converting silently to array. " I'm going to show four cases on different PHP versions: CASE 1: php -r '$a = "foo"; $a[] = "bar"; var_dump($a);' PHP 5.6.x -> Fatal Error PHP 7.0.x -> Fatal Error PHP 7.1.x -> Fatal Error CASE 2: php -r '$a = "foo"; $a["x"] = "baz"; var_dump($a);' PHP 5.6.x -> string "boo" (with illegal offset warning) PHP 7.0.x -> string "boo" (with illegal offset warning) PHP 7.1.x -> string "boo" (with illegal offset warning) CASE 3: php -r '$a = ""; $a["x"] = "bar"; var_dump($a);' PHP 5.6.x -> array("x" => "bar") with NO warnings PHP 7.0.x -> array("x" => "bar") with NO warnings PHP 7.1.x -> string "b" with illegal offset warning CASE 4: php -r '$a = ""; $a[] = "bar"; var_dump($a);' PHP 5.6.x -> array("bar") with NO warnings PHP 7.0.x -> array("bar") with NO warnings PHP 7.1.x -> Fatal Error I think what is bugging me here is that the docs talk about CASE 1 whose behaviour actually did not change, so it should mention "empty string" because that's where the actual change happened (CASE 4), also I think that CASE 3 should be rethinked. In general I would like to raise a concern on the fact that I think the previous behaviour was better, after all PHP is dynamically typed so why not allow a variable to silently change its value silently? We know that using offset with strings is always illegal (CASE 2) so why not *always* converting it to an array and discard its previous value? [1] http://php.net/manual/en/migration71.incompatible.php#migration71.incompatible.empty-string-index-operator