Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Truncated/missing form data when form contains large number of inputs?

The Background
I am using CodeIgniter 2.1.4 and PHP 5.3 running on Nginx. I have an HTML form representing what is essentially rows of homogeneous data. Each "row" has several <input /> fields, each with the same name. Here's a simplified example:

<input type="text" name="firstname[]" />
<input type="text" name="lastname[]" />

So, I've got many firstname[] inputs, lastname[] inputs, etc. After submitting the form (the action is POST), I retrieve the data in a controller method like so (note that I'm using CodeIgniter):

$firstnames = $this->input->post('firstnames');
$lastnames = $this->input->post('lastnames');

These variables are arrays containing the values from the corresponding rows in the form, and from here I do some processing on this data.

The Problem
When the number of rows in the form is large (several hundred), the size of the resulting PHP arrays do not match the number of inputs in the form -- for example, the form might have 200 firstname inputs, but the $firstname array only has 167. What's more, the $lastname variable has a different size as well -- 166.

When the form has a smaller number of elements, everything works fine.

My theory is that I am exceeding some sort of maximum size setting or buffer somewhere in the stack, causing the form data to be truncated. Is there a PHP or CodeIgniter or nginx setting for "maximum form size" that I am not aware of?

For what it's worth, I have seen the same behavior when using both application/x-www-form-urlencoded or multipart/form-data as the content type for the form.

What am I missing?

like image 210
Donut Avatar asked Mar 22 '23 19:03

Donut


1 Answers

Assuming no suhosin... Then see: max_input_vars and max_input_nesting_level.

These are newer and often overlooked when people think of POST limits in PHP.

But if its truncated like you say then maybe it is just your post_max_size.

Also, this just has to be a dupe question...

PHP max_input_vars Increasing the maximum post size etc..

like image 93
ficuscr Avatar answered Apr 06 '23 01:04

ficuscr