[TASK] Install Tool: Check always_populate_raw_post_data setting 32/42532/2
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Tue, 11 Aug 2015 21:26:56 +0000 (23:26 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 11 Aug 2015 22:11:49 +0000 (00:11 +0200)
PHP 5.6 deprecated automatically populating the HTTP_RAW_POST_DATA
variable and introduced a deprecation notice. If the setting is left at
the default value of 0 requests in the core can trigger this notice
although HTTP_RAW_POST_DATA isn't being used or accessed.

Resolves: #63144
Resolves: #68337
Releases: master
Change-Id: I95be167af87afb97493b1a95fdac9a0327b21e48
Reviewed-on: http://review.typo3.org/42532
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/install/Classes/SystemEnvironment/Check.php

index c4eaa52..ba8d555 100644 (file)
@@ -85,6 +85,7 @@ class Check {
                $statusArray[] = $this->checkMaxExecutionTime();
                $statusArray[] = $this->checkDisableFunctions();
                $statusArray[] = $this->checkDownloadsPossible();
+               $statusArray[] = $this->checkAlwaysPopulateRawPostDataSetting();
                $statusArray[] = $this->checkDocRoot();
                $statusArray[] = $this->checkOpenBaseDir();
                $statusArray[] = $this->checkXdebugMaxNestingLevel();
@@ -472,6 +473,32 @@ class Check {
        }
 
        /**
+        * Check that always_populate_raw_post_data has been set to -1 on PHP 5.6 or newer
+        *
+        * @return Status\StatusInterface
+        */
+       protected function checkAlwaysPopulateRawPostDataSetting() {
+               $minimumPhpVersion = '5.6.0';
+               $currentPhpVersion = phpversion();
+               $currentAlwaysPopulaterRawPostDataSetting = ini_get('always_populate_raw_post_data');
+               if (version_compare($currentPhpVersion, $minimumPhpVersion) >= 0 && $currentAlwaysPopulaterRawPostDataSetting !== '-1') {
+                       $status = new Status\ErrorStatus();
+                       $status->setTitle('PHP always_populate_raw_post_data is deprecated');
+                       $status->setMessage(
+                               'always_populate_raw_post_data=' . $currentAlwaysPopulaterRawPostDataSetting . LF .
+                               'PHP is configured to automatically populate $HTTP_RAW_POST_DATA.' . LF .
+                               ' Warning: Expect fatal errors in central parts of the CMS' .
+                               ' if the value is not changed to:' . LF .
+                               'always_populate_raw_post_data=-1'
+                       );
+               } else {
+                       $status = new Status\OkStatus();
+                       $status->setTitle('PHP always_populate_raw_post_data is fine');
+               }
+               return $status;
+       }
+
+       /**
         * Check for doc_root ini setting
         *
         * @return Status\StatusInterface