php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55810 cannot have more than 1000 entries in the _POST array
Submitted: 2011-09-29 06:57 UTC Modified: 2012-06-15 00:56 UTC
From: clemens dot schwaighofer at e-graphics dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.8 OS: Linux
Private report: No CVE-ID: None
 [2011-09-29 06:57 UTC] clemens dot schwaighofer at e-graphics dot com
Description:
------------
System is PHP 5.3.8 on Apache 2.2.x on various systems. Debian packages and self compiled packages.

Problem:
If a script sends more than 1000 _POST entries everything above 1000 is ignore. This bug does not exist in 5.3.5, but also appears in 5.3.6

The Post MAX size is on all systems at least 20MB or more, but the size does not matter it is the element count in _POST that triggers the error

Test script:
---------------
<?

// possible bug in php 5.3.6-13 of debian/testing
// too large post data gets truncated

// write POST log
$fp = fopen(getcwd().'/DEBUG.LOG', 'a');
fwrite($fp, '['.date('Y-m-d H:i:s').'] ====>'."\n");
fwrite($fp, var_export($_POST, true)."\n");
fwrite($fp, '['.date('Y-m-d H:i:s').'] ====>'."\n");
fclose($fp);

// test if limit is really 1000
for ($i = 1; $i <= 1010; $i ++)
{
    $data['pos_'.$i] = 'DATA: '.$i;
}

?>
<html>
<head>
    <title>POST debug test</title>
</head>

<body>
PHP VERSION: <?=PHP_VERSION_ID;?><br>
<div style="color: red;">
<?
if (is_array($_POST))
{
    print "Original data: ".count($data)."<br>";
    print "POST DATA: ".count($_POST)."<br>";
    if (count($_POST) < count($data))
        print "ERROR: POST count is smaller than original data count<br>";
}
?>
</div>
<form method="post">
<?
    foreach ($data as $key => $value)
    {
?>
    <input type="hidden" name="<?=$key;?>" value="<?=urldecode($value);?>">
<?
    }
?>
    <input type="submit" name="send_post" value="Send POST">
</form>
</body>
</html>

Expected result:
----------------
_POST should keep all the sent entries and not cut at 1000.

PHP VERSION: 50305
Original data: 1010
POST DATA: 1032

Actual result:
--------------
_POST truncates all above >1000

PHP VERSION: 50306
Original data: 1010
POST DATA: 1000
ERROR: POST count is smaller than original data count

PHP VERSION: 50308
Original data: 1010
POST DATA: 1000
ERROR: POST count is smaller than original data count

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-29 13:45 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2011-09-29 13:45 UTC] cataphract@php.net
This is due to suhosin (see suhosin.post.max_vars). Note that we do NOT provide support for suhosin.
 [2011-09-30 01:15 UTC] clemens dot schwaighofer at e-graphics dot com
Actually it is not only the post.max_vars, but also the request.max_vars
 [2012-06-13 13:52 UTC] the dot aloner at gmail dot com
I'm having this problem on 5.3.13 without Suhosin. Is there anything I can 
check?

Here is the result of the test:

PHP VERSION: 50313
Original data: 1010
POST DATA: 1000
ERROR: POST count is smaller than original data count
 [2012-06-14 00:48 UTC] clemens dot schwaighofer at e-graphics dot com
@the dot aloner at gmail dot com

Yes, in the PHP ini search for "max_input_vars =" and up the value. Or add the 
entry if it is missing.
 [2012-06-14 13:02 UTC] the dot aloner at gmail dot com
Thank you for your reply.
Yes, I've added this to php.ini and restarted Apache
max_input_vars = 3000
The setting has been changed, but the problem is still there. It doesn't allow 
more than 1000 vars. :(
 [2012-06-15 00:56 UTC] clemens dot schwaighofer at e-graphics dot com
Besides this var and possible suhosin entry, I really do not know.

Is this a self compiled PHP? Or from a distribution? What version is it? etc. 
There could be many factors.
 [2012-11-21 15:06 UTC] contacto at hardcode dot com dot ar
"max_input_vars = " worked great for me. thanks! i was about to go crazy, in my case it was a screen that stopped working after updating php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC