Is it possible for there to by any type of value in $_GET
or $_POST
which is not an array or string?
For those who read code better, is it at all possible to run this simple script on a web server and get it to throw the exception?
// crash-me.php
<?php
function must_be_array_or_string($value) {
if(is_string($value))
return;
if(is_array($value)) {
foreach($value as $subValue)
must_be_array_or_string($subValue);
return;
}
throw new Exception("Value is " . gettype($value));
}
if(isset($_GET))
must_be_array_or_string($_GET);
if(isset($_POST))
must_be_array_or_string($_POST);
Except for file uploads, values are always strings or arrays.
I believe in the case of file uploads, the 'error'
and 'size'
fields would be ints
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With