$_GET is of type Array('field'=> Top)
Opened this issue · 2 comments
sk- commented
The following code will produce the error
Notice: Type mismatch: expected: Array["id" => Any, ...], found: Array["id" => Top]
echo $_GET['id'];
<?php
echo $_GET['id'];
colder commented
Hi,
indeed, because that's what it is. $_GET['id'] could be undefined, or assign to strings or arbitrary arrays. There is an option to make it less strict though.
sk- commented
Sure, but what is troubling is that the message is hard to understand. What does Top mean? Does it mean undefined or string or array
? For user defined arrays the type is much clearer.
Also, related to this, the following code does not produce any errors:
<?php
if (!is_array($_GET['id'])) {
echo $_GET['id'];
}
and should warn about $_GET[id] being undefined.