]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add check for `HTTP_RAW_POST_DATA` setting for >= 5.6
authorLukas Reschke <lukas@owncloud.com>
Thu, 22 Jan 2015 12:46:40 +0000 (13:46 +0100)
committerLukas Reschke <lukas@owncloud.com>
Thu, 22 Jan 2015 12:50:38 +0000 (13:50 +0100)
PHP 5.6 otherwise throws notices for perfectly valid code which results in broken endpoints.

Fixes https://github.com/owncloud/core/issues/13592

.htaccess
lib/private/util.php

index af7e961379c1209dbb3d828f2fe19f6307edcf72..962e969d59c8c9eb8d69f8cc4a6e8007ff5d4285 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -12,6 +12,7 @@ php_value upload_max_filesize 513M
 php_value post_max_size 513M
 php_value memory_limit 512M
 php_value mbstring.func_overload 0
+php_value always_populate_raw_post_data -1
 <IfModule env_module>
   SetEnv htaccessWorking true
 </IfModule>
index 3b943f046bfa40c2791c59ddffab75d39bbe63e6..a4d3b558ce0e7dc833dc05212537631d15035446 100644 (file)
@@ -628,6 +628,21 @@ class OC_Util {
                        );
                        $webServerRestart = true;
                }
+
+               /**
+                * PHP 5.6 ships with a PHP setting which throws notices by default for a
+                * lot of endpoints. Thus we need to ensure that the value is set to -1
+                *
+                * @link https://github.com/owncloud/core/issues/13592
+                */
+               if(version_compare(phpversion(), '5.6.0', '>=') &&
+                       \OC::$server->getIniWrapper()->getNumeric('always_populate_raw_post_data') !== -1) {
+                       $errors[] = array(
+                               'error' => 'PHP is configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code.',
+                               'hint' => 'To fix this issue set <code>always_populate_raw_post_data</code> to <code>-1</code> in your php.ini'
+                       );
+               }
+
                if (!self::isAnnotationsWorking()) {
                        $errors[] = array(
                                'error' => 'PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.',