php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52239 Maximum 127 form fields
Submitted: 2010-07-03 00:20 UTC Modified: 2010-07-03 00:40 UTC
From: derek at darkcolors dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.3.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
31 + 19 = ?
Subscribe to this entry?

 
 [2010-07-03 00:20 UTC] derek at darkcolors dot com
Description:
------------
If an html form contains more than 127 fields, any additional fields will not 
appear in $_POST, $_GET, $_POST, $_FILES.  Now will it appear as the actual 
variable name if register globals is on.  SUHOSIN is not turned on.  I'm sending 
the form as POST.  No error is reported anywhere.

Test script:
---------------
<form action="manage_site" method="post" enctype="multipart/form-data">
<input type="file" name="some_file[]>
<input type="file" name="some_file[]>
<input type="file" name="some_file[]>
......
<input type="file" name="some_file[]>
<input type="submit">
</form>

--------------------------
print_r($_FILES[some_file]); // Will post only info for the first 127 files.

Expected result:
----------------
PHP should accept an unlimited number of form fields and return them as the usual 
variables--or at least give a way for us to overrule this default limit of 127 
fields.

Actual result:
--------------
Only the first 127 array elements are saved form an html form POST.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-03 00:40 UTC] rasmus@php.net
-Status: Open +Status: Bogus
 [2010-07-03 00:40 UTC] rasmus@php.net
There is no such limit in PHP.  All I can think of is that your browser limits 
the number of upload fields.  I tested this in Firefox and it worked fine both 
for 1000 text fields and 1000 file upload fields.

My test case looked like this:

<?php
print_r($some_file);
?>
<form action="ff.php" method="POST">
<input type=submit>
<input type="text" name="some_file[]" value="/Users/rasmus/foo.txt">
...999 more identical lines...
</form>

And my output was:
Array ( [0] => /Users/rasmus/foo.txt [1] => /Users/rasmus/foo.txt [2] => 
/Users/rasmus/foo.txt [3] => /Users/rasmus/foo.txt [4] => /Users/rasmus/foo.txt 
[5] => /Users/rasmus/foo.txt
...
[995] => /Users/rasmus/foo.txt [996] => /Users/rasmus/foo.txt [997] => 
/Users/rasmus/foo.txt [998] => /Users/rasmus/foo.txt [999] => 
/Users/rasmus/foo.txt 

Since there is no 128 field limit in the code and it works perfectly for me 
against PHP 5.3.2 running on Linux as in your report, I am pretty sure this is 
not a PHP issue.  Try another browser or look for other causes.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 07:01:27 2024 UTC