0

I have a form which gets submitted to a PHP script to process the $_POST values some simple text fields but mostly arrays. I have noticed that the very last array element is missing and couldn't figure out why. Then I decided to print out file_get_contents('php://input') and it contains the missing array element. Just to be clear at the very beginning of the post script (before anything happens) I print out file_get_contents('php://input') and $_POST values and the $_POST is missing the very last element of the array which is part of the php://input. The array elements are unique so nothing gets overwritten.

Does anyone have any idea why this is happening? PHP version is 5.5

Alx
  • 1
  • 1
    Post your examples please. – Alex Howansky Nov 09 '17 at 18:12
  • How many variables are you sending in the post? Is it a lot? – RiggsFolly Nov 09 '17 at 18:13
  • They should technically be the same, as pointed out here: https://stackoverflow.com/questions/8893574/php-php-input-vs-post use a function like: $args = array(); parse_str(file_get_contents('php://input'), $args); var_dump( $args ); to convert it to an array – Jesse Schokker Nov 09 '17 at 18:14
  • 2
    If it is a very large number of values being passed check `max_input_vars` in your `php.ini` is set large enough to cope with this form – RiggsFolly Nov 09 '17 at 18:15
  • In total it's approximately 20 variables and one large multi-dimensional array with approximately 100 elements. All values are strings so all in all it's not even a half a MB and the post max size is set to 16mb – Alx Nov 09 '17 at 18:52
  • max input vars can certainly be exceeded without exceeding max post size. Try checking your phpinfo for max input vars as RiggsFolly suggested. The default is 1000, but it could have been changed. – Don't Panic Nov 09 '17 at 19:03
  • max_input_vars was the issue. Thanks everyone! – Alx Nov 09 '17 at 19:30

0 Answers0