Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$_GET is of type Array('field'=> Top) #10

Open
sk- opened this issue Sep 11, 2013 · 2 comments
Open

$_GET is of type Array('field'=> Top) #10

sk- opened this issue Sep 11, 2013 · 2 comments

Comments

@sk-
Copy link

sk- commented Sep 11, 2013

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
Copy link
Owner

colder commented Sep 11, 2013

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-
Copy link
Author

sk- commented Sep 11, 2013

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.

CaptainEmerson pushed a commit to SoftwareEngineeringToolDemos/FSE-2010-Phantm that referenced this issue Jun 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants