Skip to content

Commit

Permalink
Merge pull request #1062 from RMcLeod79/Issue-1057
Browse files Browse the repository at this point in the history
Add check to see if PHP > 5.6 and always_populate_raw_post_data = -1
  • Loading branch information
vrann committed Mar 20, 2015
2 parents b6e4c5f + 9d45fb3 commit b6927e0
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
18 changes: 18 additions & 0 deletions setup/pub/magento/setup/readiness-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ angular.module('readiness-check', [])
processed: false,
expanded: false
};
$scope.rawpost = {
visible: false,
processed: false,
expanded: false
};
$scope.extensions = {
visible: false,
processed: false,
Expand All @@ -57,6 +62,19 @@ angular.module('readiness-check', [])
$scope.stopProgress();
}
},
'php-rawpost': {
url:'index.php/environment/php-rawpost',
show: function() {
$scope.startProgress();
$scope.rawpost.visible = true;
},
process: function(data) {
$scope.rawpost.processed = true;
angular.extend($scope.rawpost, data);
$scope.updateOnProcessed($scope.rawpost.responseType);
$scope.stopProgress();
}
},
'php-extensions': {
url:'index.php/environment/php-extensions',
show: function() {
Expand Down
23 changes: 23 additions & 0 deletions setup/src/Magento/Setup/Controller/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,29 @@ public function phpVersionAction()
return new JsonModel($data);
}

/**
* Checks if PHP version >= 5.6.0 and always_populate_raw_post_data is set
*
* @return JsonModel
*/
public function phpRawpostAction()
{
$iniSetting = ini_get('always_populate_raw_post_data');
$responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;
if (version_compare(PHP_VERSION, '5.6.0') >= 0 && (int)$iniSetting > -1) {
$responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
}
$data = [
'responseType' => $responseType,
'data' => [
'version' => PHP_VERSION,
'ini' => $iniSetting
]
];

return new JsonModel($data);
}

/**
* Verifies php verifications
*
Expand Down
53 changes: 53 additions & 0 deletions setup/view/magento/setup/readiness-check/progress.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,59 @@

</div>

<div id="php-rawpost" class="rediness-check-item" ng-show="rawpost.visible">

<h3 class="readiness-check-title" ng-hide="version.processed">
Checking PHP Version and PHP Raw Post Data Settings...
</h3>

<div ng-show="rawpost.processed" ng-switch="rawpost.responseType">

<div ng-switch-when="success" ng-init="updateOnSuccess(rawpost)">

<span class="readiness-check-icon icon-success-round"></span>

<div class="readiness-check-content">
<h3 class="readiness-check-title">PHP Raw Post Data Check</h3>
<p>
You are not populating raw_post_data or your PHP version is less than 5.6.0
</p>
</div>

</div>

<div class="readiness-check-item" ng-switch-default ng-init="updateOnError(rawpost)">

<div class="rediness-check-side">
<p class="side-title">Need Help?</p>
<a href="http://www.php.net/docs.php" target="_blank">PHP Documentation</a>
</div>

<span class="readiness-check-icon icon-failed-round"></span>

<div class="readiness-check-content">
<h3 class="readiness-check-title">PHP Raw Post Data Check</h3>
<p>
Your PHP Version is {{rawpost.data.version}}<br />
always_populate_raw_post_data = {{rawpost.data.ini}}.
<a href="#php-rawpost" ng-click="updateOnExpand(rawpost)">
<span ng-hide="rawpost.expanded">Show detail</span>
<span ng-show="rawpost.expanded">Hide detail</span>
</a>
</p>
<p ng-show="rawpost.expanded">
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running,
please open your php.ini file and set always_populate_raw_post_data to -1 (uncomment if necessary)
</p>
<p ng-show="rawpost.expanded">If you need more help please call your hosting provider.</p>
</div>

</div>

</div>

</div>

<div id="php-extensions" class="rediness-check-item" ng-show="extensions.visible">

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

0 comments on commit b6927e0

Please sign in to comment.