Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check to see if PHP > 5.6 and always_populate_raw_post_data = -1 #1062

Merged
merged 2 commits into from
Mar 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -81,6 +81,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 @@ -85,6 +85,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