[TASK] Add check for max_input_vars setting in install tool 87/40987/4
authorFrank Nägler <typo3@naegler.net>
Wed, 8 Jul 2015 09:49:56 +0000 (11:49 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 9 Jul 2015 13:01:39 +0000 (15:01 +0200)
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>
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index 9f95440..49e0fa6 100644 (file)
@@ -101,6 +101,7 @@ class Check {
                        $statusArray[] = $this->checkSuhosinExecutorIncludeWhitelistContainsPhar();
                        $statusArray[] = $this->checkSuhosinExecutorIncludeWhitelistContainsVfs();
                }
+               $statusArray[] = $this->checkMaxInputVars();
                $statusArray[] = $this->checkSomePhpOpcodeCacheIsLoaded();
                $statusArray[] = $this->checkReflectionDocComment();
                $statusArray[] = $this->checkSystemLocale();
@@ -576,6 +577,43 @@ class Check {
        }
 
        /**
+        * 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
         *