Missing fields in $_POST – Rob Allen's DevNotes


I recently updated to OS X 10.8 (Mountain Lion) which has PHP 5.3.13 installed by default.

When testing something today, I discovered that a very very large form wasn't submitting all fields. It seemed that $_POST was being truncated. After a little bit of searching around I discovered the max_input_vars php.ini setting. This is new since PHP 5.3.9 and defaults to 1000.

As OS X also comes with suhosin installed, if you want to increase the number of fields for _POST you need to set the following in php.ini:

Also, ensure that suhosin.post.max_value_length and suhosin.request.max_value_length are large enough.

Update: I was pointed to Supercolliding a PHP array which explains why this setting was introduced.