note 124911 added to info.configuration
| From: | csongor at halmai dot hu | Date: | Tue, 14 Apr 2020 15:05:58 +0000 |
| Subject: | note 124911 added to info.configuration | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214472@lists.php.net to get a copy of this message | ||
The max_input_vars setting is defined as "How many input variables may be accepted" but
this is not completely correct. There is a +1 factor.
For example, if the value is 2 then the $_POST array can have up to 3 elements, if it is 1000 then
it can have 1001 elements, and so on.
I want to stop the execution of the php code when there is a chance that some data was not received.
Therefore, instead of relying on the standard E_WARNING, I do this in my code.
<?php
$max_input_vars = ini_get('max_input_vars');
if (count($_POST) === $max_input_vars + 1) { // note the +1 here
throw new Exception();
}
?>
If the size of the $_POST array reaches the maximum then there is the chance that there was more
data so it is better to stay on the safe side and increase the config value.
----
Server IP: 45.112.84.4
Probable Submitter: 38.142.137.34 (proxied: 220.253.127.73)
----
Manual Page -- http://php.net/manual/en/info.configuration.php
Edit -- https://master.php.net/note/edit/124911
Del: integrated -- https://master.php.net/note/delete/124911/integrated
Del: useless -- https://master.php.net/note/delete/124911/useless
Del: bad code -- https://master.php.net/note/delete/124911/bad+code
Del: spam -- https://master.php.net/note/delete/124911/spam
Del: non-english -- https://master.php.net/note/delete/124911/non-english
Del: in docs -- https://master.php.net/note/delete/124911/in+docs
Del: other reasons-- https://master.php.net/note/delete/124911
Reject -- https://master.php.net/note/reject/124911
Search -- https://master.php.net/manage/user-notes.php