Recently we faced an issue of form not submitting with all form fields. Let me describe the issue in details.

In CiviCRM, when creating a new Contact or updating an old one, selected tags were not saving. This was working before but suddenly this issue arose. After thorough investigation with Jilani bhai we discovered that not all fields of the form was posted or in other words the PHP $_POST variable have not listed all fields. In our Windows machine we got all the fields but in Linux box the issue existed. First we thought the issue might have caused due to the PHP directive “post_max_size”, though it was set to 24M. We tried with updating it to 128M. But the issue was still there.

Then we searched Google and got a clue from Our server was using PHP 5.3.22. So, we looked for the “max_input_vars” directive which was new since 5.3.9, it was set to 1000 by default. We increased the number to 2000 and the issue was resolved. Due to the number of groups in the form, the field number increased to more than 1000. So, PHP was truncating the POST data and at most 1000 fields were returned.Missing fields in $_POST – Rob Allen's DevNotes
Missing fields in $_POST – Rob Allen's DevNotes
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.

fb_anonymous_user's picture

Great finding boss!

fb_anonymous_user's picture

gr8 finding... PHP introduced max_input_vars to prevent DDoS attacks...

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.