查询变量不能超过512个字符 [英] Query variable can be no longer than 512 characters

查看:132
本文介绍了查询变量不能超过512个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力读取$_GET数组中包含超过512个字符的查询变量.但是,如果我使用parse_string解析查询字符串,则可以从结果数组中很好地读取它.

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.

示例:

# 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>
?>

这对我来说毫无意义,因为$_GET在内部使用parse_str从查询字符串中派生查询变量.我想念什么吗?

This makes no sense to me, since $_GET uses parse_str internally to derive the query variables from the query string. Am I missing something?

推荐答案

有一个PHP错误报告. #50449

There is a PHP bug report. #50449

GET参数的值超过512个字符不会显示在 $ _GET和$ _REQUEST数组.自升级到 5.3.1

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

它说那里是Suhosin引起的行为.

It says there that it is Suhosin causing the behaviour.

这篇关于查询变量不能超过512个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆