[FEATURE] Install tool: Check xdebug.max_nesting_level 49/21549/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 20 Jun 2013 18:40:31 +0000 (20:40 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 20 Jun 2013 19:02:58 +0000 (21:02 +0200)
If PHP xdebug extension is loaded, TYPO3 CMS can fail with the
xdebug.max_nesting_level default value of 100. This is easily
triggered by fluid, and since we have fluid in the install tool
we need a check that gives an administrator a nice warning if the
nesting level is not set high enough for our demands.

Change-Id: I4812e7f47b04219d380d7454d51b2e6b74436b6d
Resolves: #49298
Related: #49162
Releases: 6.2
Reviewed-on: https://review.typo3.org/21549
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index ca3b76c..f00d1a3 100644 (file)
@@ -97,6 +97,7 @@ class Check {
                $statusArray[] = $this->checkSafeMode();
                $statusArray[] = $this->checkDocRoot();
                $statusArray[] = $this->checkOpenBaseDir();
+               $statusArray[] = $this->checkXdebugMaxNestingLevel();
                $statusArray[] = $this->checkOpenSslInstalled();
                $statusArray[] = $this->checkSuhosinLoaded();
                $statusArray[] = $this->checkSuhosinRequestMaxVars();
@@ -476,7 +477,40 @@ class Check {
        }
 
        /**
+        * If xdebug is loaded, the default max_nesting_level of 100 must be raised
+        *
+        * @return Status\ErrorStatus|Status\OkStatus
+        */
+       protected function checkXdebugMaxNestingLevel() {
+               if (extension_loaded('xdebug')) {
+                       $recommendedMaxNestingLevel = 250;
+                       $currentMaxNestingLevel = ini_get('xdebug.max_nesting_level');
+                       if ($currentMaxNestingLevel < $recommendedMaxNestingLevel) {
+                               $status = new Status\ErrorStatus();
+                               $status->setTitle('PHP xdebug.max_nesting_level not high enough');
+                               $status->setMessage(
+                                       'xdebug.max_nesting_level=' . $currentMaxNestingLevel . '. This setting' .
+                                       ' controls the maximum number of nested function calls to protect against' .
+                                       ' infinite recursion. The current value is too low for TYPO3 CMS and must' .
+                                       ' be either raised or xdebug unloaded. A value of ' . $recommendedMaxNestingLevel .
+                                       ' is recommended. Warning: Expect fatal PHP errors in central parts of the CMS' .
+                                       ' if the default value of 100 is not raised significantly.'
+                               );
+                       } else {
+                               $status = new Status\OkStatus();
+                               $status->setTitle('PHP xdebug.max_nesting_level ok');
+                       }
+               } else {
+                       $status = new Status\OkStatus();
+                       $status->setTitle('PHP xdebug extension not loaded');
+               }
+               return $status;
+       }
+
+       /**
         * Check accessibility and functionality of OpenSSL
+        *
+        * @return Status\NoticeStatus|Status\OkStatus
         */
        protected function checkOpenSslInstalled() {
                if (extension_loaded('openssl')) {