Skip to content

Commit b6927e0

Browse files
committed
Merge pull request #1062 from RMcLeod79/Issue-1057
Add check to see if PHP > 5.6 and always_populate_raw_post_data = -1
2 parents b6e4c5f + 9d45fb3 commit b6927e0

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

setup/pub/magento/setup/readiness-check.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ angular.module('readiness-check', [])
3232
processed: false,
3333
expanded: false
3434
};
35+
$scope.rawpost = {
36+
visible: false,
37+
processed: false,
38+
expanded: false
39+
};
3540
$scope.extensions = {
3641
visible: false,
3742
processed: false,
@@ -57,6 +62,19 @@ angular.module('readiness-check', [])
5762
$scope.stopProgress();
5863
}
5964
},
65+
'php-rawpost': {
66+
url:'index.php/environment/php-rawpost',
67+
show: function() {
68+
$scope.startProgress();
69+
$scope.rawpost.visible = true;
70+
},
71+
process: function(data) {
72+
$scope.rawpost.processed = true;
73+
angular.extend($scope.rawpost, data);
74+
$scope.updateOnProcessed($scope.rawpost.responseType);
75+
$scope.stopProgress();
76+
}
77+
},
6078
'php-extensions': {
6179
url:'index.php/environment/php-extensions',
6280
show: function() {

setup/src/Magento/Setup/Controller/Environment.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,29 @@ public function phpVersionAction()
8787
return new JsonModel($data);
8888
}
8989

90+
/**
91+
* Checks if PHP version >= 5.6.0 and always_populate_raw_post_data is set
92+
*
93+
* @return JsonModel
94+
*/
95+
public function phpRawpostAction()
96+
{
97+
$iniSetting = ini_get('always_populate_raw_post_data');
98+
$responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;
99+
if (version_compare(PHP_VERSION, '5.6.0') >= 0 && (int)$iniSetting > -1) {
100+
$responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
101+
}
102+
$data = [
103+
'responseType' => $responseType,
104+
'data' => [
105+
'version' => PHP_VERSION,
106+
'ini' => $iniSetting
107+
]
108+
];
109+
110+
return new JsonModel($data);
111+
}
112+
90113
/**
91114
* Verifies php verifications
92115
*

setup/view/magento/setup/readiness-check/progress.phtml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,59 @@
8888

8989
</div>
9090

91+
<div id="php-rawpost" class="rediness-check-item" ng-show="rawpost.visible">
92+
93+
<h3 class="readiness-check-title" ng-hide="version.processed">
94+
Checking PHP Version and PHP Raw Post Data Settings...
95+
</h3>
96+
97+
<div ng-show="rawpost.processed" ng-switch="rawpost.responseType">
98+
99+
<div ng-switch-when="success" ng-init="updateOnSuccess(rawpost)">
100+
101+
<span class="readiness-check-icon icon-success-round"></span>
102+
103+
<div class="readiness-check-content">
104+
<h3 class="readiness-check-title">PHP Raw Post Data Check</h3>
105+
<p>
106+
You are not populating raw_post_data or your PHP version is less than 5.6.0
107+
</p>
108+
</div>
109+
110+
</div>
111+
112+
<div class="readiness-check-item" ng-switch-default ng-init="updateOnError(rawpost)">
113+
114+
<div class="rediness-check-side">
115+
<p class="side-title">Need Help?</p>
116+
<a href="http://www.php.net/docs.php" target="_blank">PHP Documentation</a>
117+
</div>
118+
119+
<span class="readiness-check-icon icon-failed-round"></span>
120+
121+
<div class="readiness-check-content">
122+
<h3 class="readiness-check-title">PHP Raw Post Data Check</h3>
123+
<p>
124+
Your PHP Version is {{rawpost.data.version}}<br />
125+
always_populate_raw_post_data = {{rawpost.data.ini}}.
126+
<a href="#php-rawpost" ng-click="updateOnExpand(rawpost)">
127+
<span ng-hide="rawpost.expanded">Show detail</span>
128+
<span ng-show="rawpost.expanded">Hide detail</span>
129+
</a>
130+
</p>
131+
<p ng-show="rawpost.expanded">
132+
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running,
133+
please open your php.ini file and set always_populate_raw_post_data to -1 (uncomment if necessary)
134+
</p>
135+
<p ng-show="rawpost.expanded">If you need more help please call your hosting provider.</p>
136+
</div>
137+
138+
</div>
139+
140+
</div>
141+
142+
</div>
143+
91144
<div id="php-extensions" class="rediness-check-item" ng-show="extensions.visible">
92145

93146
<h3 ng-hide="extensions.processed" class="readiness-check-title">

0 commit comments

Comments
 (0)