Large forms not saving in SugarCRM

I ran into an interesting issue for a client with project templates only saving the first 47 tasks. Viewing the ajax post using Firebug showed that every task was being sent over. Now it was time to debug the server side.

Within modules/Projects/SaveGrid.php I threw in some debug statements:

....
for ($i = 1; $i <= $_REQUEST['numRowsToSave']; $i++) {
// don't save any blank rows
if (isset($_REQUEST["duration_" . $i]) && ($_REQUEST["duration_" . $i] != "")) {
....
} else {
$GLOBALS['log']->fatal("Task ".$i." has no duration");
}
....

Sure enough, tasks 48 and up had no duration. So I dumped the request before the for loop to see how the parameters looked and it ends up there were 1001 parameters. None for anything related to task 48 and up. Before all of this I did a phpinfo() page to see what the environment configuration was. Previously I thought we were running into timeout or memory issues. At the bottom of the phpinfo page it showed that Suhosin was being used which is a somewhat popular project to deal with a number of known PHP flaws/security vulnerabilities (http://www.hardened-php.net/suhosin/).

Now 1001 is a weird number for someone to cutoff at so I assumed that was due to something within the app or a general programming error in Suhosin. So I searched for Suhosin 1000 parameters and found that there is a max_vars setting that many installs limit to 1000. The client then bumped this up to a much higher number (see http://anothersysadmin.wordpress.com/2012/02/16/php-5-3-max_input_var) and all tasks started to save.

about

I make high quality solutions at an alarming rate.

6 Responses to “Large forms not saving in SugarCRM”

  1. Edna March 17, 2013 at 12:54 am # Reply

    I wanted to thank you for this fantastic read!! I
    absolutely enjoyed every bit of it. I’ve got you bookmarked to check out new things you post…

  2. Matthew Poer July 29, 2013 at 7:58 am # Reply

    This sounds related to bug 62922, saving large quotes or working with workflows can sometimes truncate data due to max_input_vars settings.

    http://www.sugarcrm.com/support/bugs.html#issue_62922.

    Had a customer create a massive quote once, dozens of line items, and it just didn’t save.

  3. Earlene September 22, 2013 at 1:52 am # Reply

    Hello jjust wanted to give you a quick heads up. The text iin your
    article seem to be running off the screen in Firefox. I’m not sure if this is a format issue or something to
    do with browser compatibility but I thought I’d post to let you
    know. The design and style look great though! Hope you
    get the issue resolved soon. Many thanks

  4. Maddison October 1, 2013 at 8:12 am # Reply

    Thankls for finally writiung about >Large forms nnot saving in
    SugarCRM | eggsurplus solutions <Loved it!

  5. Leon November 1, 2013 at 3:39 am # Reply

    Whats up are using WordPress for youhr site platform? I’m new to the blog world but I’m trying to get
    started and create my own. Do you require any html coding knowledge to make your own blog?
    Any heop would be greatly appreciated!

  6. snort this November 18, 2013 at 7:22 am # Reply

    Enjoyed reading this, very good stuff, thanks.

Leave a Reply