Merge pull request #191 from silverstripe-rebelalliance/inputVars

NEW: Add a check + error message if input vars is exceded
This commit is contained in:
Will Rossiter 2014-07-06 16:07:33 +12:00
commit 8c33896798

View File

@ -223,6 +223,16 @@ class FieldEditor extends FormField {
$className = (isset($_REQUEST['Type'])) ? $_REQUEST['Type'] : ''; $className = (isset($_REQUEST['Type'])) ? $_REQUEST['Type'] : '';
if(!$className) { if(!$className) {
// A possible reason for the classname being blank is because we have execeded
// the number of input requests
// http://www.php.net/manual/en/info.configuration.php#ini.max-input-vars
$maxRequests = ini_get('max_input_vars');
$numRequests = count($_REQUEST, COUNT_RECURSIVE);
if ($numRequests > $maxRequests) {
$error = sprintf('You have exceded the maximum number %s of input requests',
"[$maxRequests]");
user_error($error, E_USER_WARNING);
}
user_error('Please select a field type to created', E_USER_WARNING); user_error('Please select a field type to created', E_USER_WARNING);
} }