Developing software in the Real World

Missing fields in $_POST

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.

2 thoughts on “Missing fields in $_POST

  1. my boss ran into this issue when he was submitting a form with more than 1000 elements, I just asked him WHY, WHY, WHY lol.

    We figured out he had to increase this to make his form work but after doing so everything worked.

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *