Skip to content

Commit 361a752

Browse files
committed
MAGETWO-44547: [php7] "PHP Settings Check" fail in Web Setup Wizard blocks installation via web
- added check for php 7.0
1 parent 1f0b802 commit 361a752

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

setup/src/Magento/Setup/Model/PhpReadinessCheck.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,20 +198,26 @@ private function checkPopulateRawPostSetting()
198198

199199
$data = [];
200200
$error = false;
201-
$iniSetting = intVal(ini_get('always_populate_raw_post_data'));
201+
$rawPostData = ini_get('always_populate_raw_post_data');
202+
$iniSetting = $rawPostData !== false ? intval($rawPostData) : null;
202203

203-
if (version_compare(PHP_VERSION, '5.6.0') >= 0 && $iniSetting !== -1) {
204+
if (version_compare(PHP_VERSION, '5.6.0') >= 0
205+
&& version_compare(PHP_VERSION, '7.0.0') < 0
206+
&& ($iniSetting !== -1 && $iniSetting !== null)
207+
) {
208+
$error = true;
209+
} elseif (version_compare(PHP_VERSION, '7.0.0') >= 0 && $iniSetting !== null) {
204210
$error = true;
205211
}
206212

207213
$message = sprintf(
208214
'Your PHP Version is %s, but always_populate_raw_post_data = %d.
209-
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running.
210-
Please open your php.ini file and set always_populate_raw_post_data to -1.
211-
If you need more help please call your hosting provider.
212-
',
215+
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and is removed from PHP 7.0 onwards.
216+
This will stop the installer from running.
217+
Please open your php.ini file and remove always_populate_raw_post_data.
218+
If you need more help please call your hosting provider.',
213219
PHP_VERSION,
214-
intVal(ini_get('always_populate_raw_post_data'))
220+
$iniSetting
215221
);
216222

217223
$data['always_populate_raw_post_data'] = [

setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ public function testCheckPhpSettings()
188188
);
189189
$rawPostMessage = sprintf(
190190
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
191-
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running.
192-
Please open your php.ini file and set always_populate_raw_post_data to -1.
193-
If you need more help please call your hosting provider.
194-
',
191+
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and is removed from PHP 7.0 onwards.
192+
This will stop the installer from running.
193+
Please open your php.ini file and remove always_populate_raw_post_data.
194+
If you need more help please call your hosting provider.',
195195
PHP_VERSION
196196
);
197197
$expected = [
@@ -224,10 +224,10 @@ public function testCheckPhpSettingsFailed()
224224
);
225225
$rawPostMessage = sprintf(
226226
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
227-
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running.
228-
Please open your php.ini file and set always_populate_raw_post_data to -1.
229-
If you need more help please call your hosting provider.
230-
',
227+
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and is removed from PHP 7.0 onwards.
228+
This will stop the installer from running.
229+
Please open your php.ini file and remove always_populate_raw_post_data.
230+
If you need more help please call your hosting provider.',
231231
PHP_VERSION
232232
);
233233
$expected = [
@@ -252,10 +252,10 @@ public function testCheckPhpSettingsNoXDebug()
252252
$this->phpInfo->expects($this->once())->method('getCurrent')->willReturn([]);
253253
$rawPostMessage = sprintf(
254254
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
255-
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running.
256-
Please open your php.ini file and set always_populate_raw_post_data to -1.
257-
If you need more help please call your hosting provider.
258-
',
255+
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and is removed from PHP 7.0 onwards.
256+
This will stop the installer from running.
257+
Please open your php.ini file and remove always_populate_raw_post_data.
258+
If you need more help please call your hosting provider.',
259259
PHP_VERSION
260260
);
261261
$expected = [

0 commit comments

Comments
 (0)