[TASK] Ignore pcntl_* php function in disable_functions check 24/19524/6
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 2 Apr 2013 21:13:51 +0000 (23:13 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 5 Apr 2013 12:54:17 +0000 (14:54 +0200)
The check for disable_functions gives a warning on a Ubuntu OS.
To not give a false alarm we set the status to Notice if
only functions are disabled that are currently not used by TYPO3.

Change-Id: I2cc6de83dc805faf65f68e8c315b68a2f2576e81
Resolves: #46877
Releases: 6.1
Reviewed-on: https://review.typo3.org/19524
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index 41463ad..c503203 100644 (file)
@@ -357,17 +357,41 @@ class Check {
         */
        protected function checkDisableFunctions() {
                $disabledFunctions = trim(ini_get('disable_functions'));
-               if (strlen($disabledFunctions) > 0) {
+
+               // Filter "disable_functions"
+               $disabledFunctionsArray = $this->trimExplode(',', $disabledFunctions);
+
+               // Array with strings to find
+               $findStrings = array(
+                       // Disabled by default on Ubuntu OS but this is okay since the Core does not use them
+                       'pcntl_',
+               );
+               foreach ($disabledFunctionsArray as $key => $disabledFunction) {
+                       foreach ($findStrings as $findString) {
+                               if (strpos($disabledFunction, $findString) !== FALSE) {
+                                       unset($disabledFunctionsArray[$key]);
+                               }
+                       }
+               }
+
+               if (strlen($disabledFunctions) > 0 && count($disabledFunctionsArray) > 0) {
                        $status = new ErrorStatus();
                        $status->setTitle('Some PHP functions disabled');
                        $status->setMessage(
                                'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . '. These function(s)' .
-                               'are disabled. If TYPO3 uses any of these there might be trouble. TYPO3 is designed to use the default' .
-                               ' set of PHP functions plus some common extensions. Possibly these functions are disabled' .
+                               ' are disabled. TYPO3 uses some of those, so there might be trouble. TYPO3 is designed to use the' .
+                               ' default set of PHP functions plus some common extensions. Possibly these functions are disabled' .
                                ' due to security considerations and most likely the list would include a function like' .
                                ' exec() which is used by TYPO3 at various places. Depending on which exact functions' .
                                ' are disabled, some parts of the system may just break without further notice.'
                        );
+               } elseif (strlen($disabledFunctions) > 0 && count($disabledFunctionsArray) === 0) {
+                       $status = new NoticeStatus();
+                       $status->setTitle('Some PHP functions currently disabled but OK');
+                       $status->setMessage(
+                               'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . '. These function(s)' .
+                               ' are disabled. TYPO3 uses currently none of those, so you are good to go.'
+                       );
                } else {
                        $status  = new OkStatus();
                        $status->setTitle('No disabled PHP functions');