Doc #60728 [Opn->Csd]: max_input_vars doesn't limiting multi-dimensional arrays

From: Date: Sat, 21 Jan 2012 23:09:22 +0000
Subject: Doc #60728 [Opn->Csd]: max_input_vars doesn't limiting multi-dimensional arrays
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7810@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60728&edit=1 ID: 60728 Updated by: frozenfire@php.net Reported by: sv3tli0 at bgspot dot eu Summary: max_input_vars doesn't limiting multi-dimensional arrays -Status: Open +Status: Closed Type: Documentation Problem Package: Variables related Operating System: Any PHP Version: 5.3.9 -Assigned To: +Assigned To: frozenfire Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2012-01-21 23:09:07] frozenfire@php.net Automatic comment from SVN on behalf of frozenfire Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=322553 Log: Rewrote max_input_vars directive description for clarity, and indicated that this limit applies only to each nesting level of a multidimensional input array. Closes bug #60728. ------------------------------------------------------------------------ [2012-01-12 17:34:57] rasmus@php.net The limit is per-nesting level actually because it is protecting against a hash- collision DoS attack and only elements at the same nesting level can collide. So the code is fine, the documentation needs to be clearer. ------------------------------------------------------------------------ [2012-01-12 14:16:48] sv3tli0 at bgspot dot eu I have one miss at the test code! var_dump(count($_POST)); must be : var_dump(count($_POST[a])); ------------------------------------------------------------------------ [2012-01-12 14:14:47] sv3tli0 at bgspot dot eu Description: ------------ The max_input_vars doesn't limiting multi-dimensional arrays! If user post var[] the uploaded array wont be limitted. Test script: --------------- <form action="" method="post"> <?php $max_input_vars = ini_get('max_input_vars'); for ($i=0; $i < $max_input_vars + 5; $i++) { echo "<input type='hidden' name='a[]' value='$i'>\n"; } var_dump($max_input_vars); var_dump(count($_POST)); ?> <input type="submit"> </form> Expected result: ---------------- string(4) "1000" int(1000) Actual result: -------------- string(4) "1000" int(1005) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60728&edit=1

« previous php.doc.bugs (#7810) next »