From 91a7c79b92cfe3b874ea7df5069a7bfea8f7e791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20N=C3=A4gler?= <typo3@naegler.net> Date: Wed, 8 Jul 2015 11:49:56 +0200 Subject: [PATCH] [TASK] Add check for max_input_vars setting in install tool This patch add a check for max_input_vars setting. Resolves: #67978 Related: #64615 Releases: master Change-Id: Ib8b376184582733c85979a164da6580741472485 Reviewed-on: http://review.typo3.org/40987 Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de> Tested-by: Frederic Gaus <frederic.gaus@flagbit.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../Classes/SystemEnvironment/Check.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/typo3/sysext/install/Classes/SystemEnvironment/Check.php b/typo3/sysext/install/Classes/SystemEnvironment/Check.php index 9f9544063349..49e0fa632c5b 100644 --- a/typo3/sysext/install/Classes/SystemEnvironment/Check.php +++ b/typo3/sysext/install/Classes/SystemEnvironment/Check.php @@ -101,6 +101,7 @@ class Check { $statusArray[] = $this->checkSuhosinExecutorIncludeWhitelistContainsPhar(); $statusArray[] = $this->checkSuhosinExecutorIncludeWhitelistContainsVfs(); } + $statusArray[] = $this->checkMaxInputVars(); $statusArray[] = $this->checkSomePhpOpcodeCacheIsLoaded(); $statusArray[] = $this->checkReflectionDocComment(); $statusArray[] = $this->checkSystemLocale(); @@ -575,6 +576,43 @@ class Check { return $status; } + /** + * Get max_input_vars status + * + * @return Status\StatusInterface + */ + protected function checkMaxInputVars() { + $recommendedMaxInputVars = 1500; + $minimumMaxInputVars = 1000; + $currentMaxInputVars = ini_get('max_input_vars'); + + if ($currentMaxInputVars < $minimumMaxInputVars) { + $status = new Status\ErrorStatus(); + $status->setTitle('PHP max_input_vars too low'); + $status->setMessage( + 'max_input_vars=' . $currentMaxInputVars . LF . + 'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS' . + ' (as the install tool does). It is highly recommended to raise this' . + ' to at least ' . $recommendedMaxInputVars . ':' . LF . + 'max_input_vars=' . $recommendedMaxInputVars + ); + } elseif ($currentMaxInputVars < $recommendedMaxInputVars) { + $status = new Status\WarningStatus(); + $status->setTitle('PHP max_input_vars very low'); + $status->setMessage( + 'max_input_vars=' . $currentMaxInputVars . LF . + 'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS' . + ' (as the install tool does). It is highly recommended to raise this' . + ' to at least ' . $recommendedMaxInputVars . ':' . LF . + 'max_input_vars=' . $recommendedMaxInputVars + ); + } else { + $status = new Status\OkStatus(); + $status->setTitle('PHP max_input_vars ok'); + } + return $status; + } + /** * Get suhosin loaded status * Should be called only if suhosin extension is loaded -- GitLab