Query variable can be no longer than 512 characters
I'm struggling to read query variables that contain more than 512 characters in the $_GET
array. If I parse the query string using parse_string
, however, I can read it just fine from the resulting array.
Example:
# GET /test.php?foo=<string with 513 characters>&bar=bar HTTP/1.1
<?php
var_dump($_GET['foo']); # NULL
var_dump($_GET['bar']); # "bar"
parse_str($_SERVER['QUERY_STRING'], $output);
var_dump($output['foo']); # <string with 513 characters>
?>
This makes no sense to me, since $_GET
uses parse_str
internally to derive the query variables from the query string开发者_Go百科. Am I missing something?
There is a PHP bug report. #50449
GET parameters with a value longer than 512 characters don't show up in the $_GET and $_REQUEST arrays. We've noticed this since upgrading to 5.3.1
It says there that it is Suhosin causing the behaviour.
精彩评论