From bb80cf4ecab3a92541bf9c2fccaa204b6ea914f9 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 22 Jan 2015 13:46:40 +0100 Subject: [PATCH 1/3] Add check for `HTTP_RAW_POST_DATA` setting for >= 5.6 PHP 5.6 otherwise throws notices for perfectly valid code which results in broken endpoints. Fixes https://github.com/owncloud/core/issues/13592 --- .htaccess | 1 + lib/private/util.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/.htaccess b/.htaccess index af7e961379c..962e969d59c 100644 --- 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 SetEnv htaccessWorking true diff --git a/lib/private/util.php b/lib/private/util.php index 3b943f046bf..a4d3b558ce0 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -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 always_populate_raw_post_data to -1 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.', From 55c28608c998c2a09ae572186ccff2075a768843 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 22 Jan 2015 14:52:47 +0100 Subject: [PATCH 2/3] translate error messages --- lib/private/util.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/util.php b/lib/private/util.php index a4d3b558ce0..2ec526cf35e 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -638,15 +638,15 @@ class OC_Util { 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 always_populate_raw_post_data to -1 in your php.ini' + 'error' => $l->t('PHP is configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code.'), + 'hint' => $l->t('To fix this issue set always_populate_raw_post_data to -1 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.', - 'hint' => 'This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.' + 'error' => $l->t('PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.'), + 'hint' => $l->t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.') ); } From 4403c194c1a4b439c2feb9a7c7740da1632827fa Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 22 Jan 2015 23:18:16 +0100 Subject: [PATCH 3/3] add always_populate_raw_post_data to .user.ini --- .user.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/.user.ini b/.user.ini index 9f3691e5fba..09f6a05ff6c 100644 --- a/.user.ini +++ b/.user.ini @@ -2,3 +2,4 @@ upload_max_filesize=513M post_max_size=513M memory_limit=512M mbstring.func_overload=0 +always_populate_raw_post_data=-1