Closed fredricj closed 6 years ago
Thank you for reporting @fredricj. For some reason, I can not reproduce. Would you please check this code fragment in your environment?
function local_scope_only() {
$row = [1,2,3];
$plates = [];
foreach ($row as $t) {
$header = "t";
$plates[$header][] = $t; // Gives "Cannot use string offset as an array"
}
}
Wrapping it in a function does not trigger the message but removing the function scope from your code fragment emits the message again
Got it: I'll make adjustments. The inspection will skip global context and stick to functions and methods only.
Fixed
The following (simplified) code triggers "Unsupported string offset operations: Provokes a PHP Fatal error (cannot use string offset as an array)":