Long query string variable missing

别等时光非礼了梦想. 提交于 2020-01-03 00:27:28

问题


I've got a pretty long query string variable (value is approximately 600 chars) that I'm trying to reach from a PHP script. The long one is not present in $_REQUEST or $_GET but another variable with shorter value length is. I've shaved off some of it to test and it starts going missing when the value is at 549 chars or more.

Fortunately the long variable is present in $_SERVER["QUERY_STRING"] so for now I'm just picking it up from there, but was curious as to if this is a server setting (Apache 2) or something with my PHP setup (5.2.17) or script?

BTW, the query string itself is not something I control so unfortunately I can't change how that works, for ex. sending via POST.


回答1:


Maybe you have a hardend/suhosin version of php. It provides configuration directives to limit the length of names and values for input parameters.

suhosin.get.max_name_length

    Type: Integer
    Default: 64
Defines the maximum length of variable names for variables registered through the URL. For array variables this is the name in front of the indices.

suhosin.get.max_totalname_length

    Type: Integer
    Default: 256
Defines the maximum length of the total variable name when registered through the URL. For array variables this includes all indices.

suhosin.get.max_value_length

    Type: Integer
    Default: 512
Defines the maximum length of a variable that is registered through the URL.



回答2:


I just ran into this in PHP 5.4 in Debian Wheezy, which does not use suhosin. I finally found this user note buried on the parse_str() page that max_input_vars in php.ini setting controls the number of variables parse_str() will read in this version of PHP.

Also note that max_input_vars applies even if you are using the CLI runtime.



来源:https://stackoverflow.com/questions/8485908/long-query-string-variable-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!