Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data cut off during $_POST Request

I'm having trouble figuring out what the problem is with the following $_POST request. The issue is that I am $_POSTing an array with 855 records via AJAX, but my AJAX controller is only receiving 833. It's always the same records received, and it always cuts out at the same point:

JQuery:

var f = {};
f.chargeID = chargeID;
f.method = 'saveIndividualApplications';
f.individualAmounts = individualAmts;

processing.show();

console.log(f); //all records present
console.log(Object.keys(f.individualAmounts).length); //855

return $.ajax({
    type: 'post',
    cache: false,
    url: appControllerPath,
    data: f
});

PHP controller:

$displayMaxSize = ini_get('post_max_size'); //125912
file_put_contents('post', $_SERVER['CONTENT_LENGTH'] . "\r\n"); //240M (increased this to 240 just to check)
file_put_contents('post', $displayMaxSize . "\r\n", FILE_APPEND);
file_put_contents('post', print_r($_SERVER, true), FILE_APPEND);
file_put_contents('post', count($_POST['individualAmounts']) . "\r\n", FILE_APPEND); //833
file_put_contents('post', print_r($_POST['individualAmounts'], true), FILE_APPEND); // data cuts off midway through 833rd record (although the array seems to close fine)
like image 955
Eamonn Avatar asked Dec 14 '22 12:12

Eamonn


1 Answers

It can be limited by max_input_vars config option, by default it's limited to 1000. Inroduced in 5.3.9, check the PHP runtime config

Or if you are using Suhosin it may by limited by it

[suhosin]
suhosin.request.max_vars = 1000
suhosin.post.max_vars = 1000
like image 70
miller Avatar answered Dec 17 '22 01:12

miller