Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I stop Symfony from truncating my POSTed object?

Tags:

post

php

symfony

I am using Symfony 2.6 and need to post a rather large amount of data (~95000+ bytes). The posting to the server works fine and I access my posted data in my Symfony controller using

$request->get('myData')

However, only part of the object is actually forwarded to my controller. I can see this on the Symfony profiler which shows me the object and the actual raw posted form-encoded data. The form-encoded data is complete whereas the object just breaks down at some point. So since the server receives all of the data this can not be caused by a PHP POST limit.

This is the format my object has (as formatted by the Symfony Profiler):

[
    0 => [
      firstKey => firstValue0,
      secondKey => secondValue0,
      thirdKey => thirdValue0
    ]
    1 => [
      firstKey => firstValue1,
      secondKey => secondValue1,
      thirdKey => thirdValue1
    ]

    ...etc...

    333 => [
      firstKey => firstValue333,
      secondKey => secondValue333
    ]
]

All of the objects in the array are supposed to have all the same three keys. Also from looking at the raw posted content there should be 800 entries. However, as you can see, Symfony stops interpreting the input at entry 333 and does not even completely interpret this one as it is missing the last key-value pair.

This makes me think that Symfony has a restriction on the amount of input parsing it will do. Does anyone know where I can adjust this limit? Or is there something else that I could be doing wrong?

like image 775
Chris Avatar asked Jan 14 '15 16:01

Chris


1 Answers

By default, PHP >=5.3.9 has a 1000 variable maximum for get/post/cookie entries. You can override this in your php.ini file.

max_input_vars = 10000
like image 57
Justin Howard Avatar answered Sep 20 '22 20:09

Justin Howard