Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into MAGETWO-59702
Browse files Browse the repository at this point in the history
  • Loading branch information
adifucan committed Oct 26, 2016
2 parents 058a78f + 9666070 commit d9d75e8
Show file tree
Hide file tree
Showing 173 changed files with 1,579 additions and 371 deletions.
17 changes: 14 additions & 3 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
#ini_set('display_errors', 1);

/* PHP version validation */
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700 || PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) {
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID >= 50605 && PHP_VERSION_ID < 50700 || PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) {
if (PHP_SAPI == 'cli') {
echo 'Magento supports PHP 5.6, 7.0.2, 7.0.4, and 7.0.6 or later. ' .
echo 'Magento supports PHP 5.6.5, 7.0.2, 7.0.4, and 7.0.6 or later. ' .
'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
} else {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<p>Magento supports PHP 5.6, 7.0.2, 7.0.4, and 7.0.6 or later. Please read
<p>Magento supports PHP 5.6.5, 7.0.2, 7.0.4, and 7.0.6 or later. Please read
<a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
Magento System Requirements</a>.
</div>
Expand All @@ -35,6 +35,17 @@
$mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
umask($mask);

if (empty($_SERVER['ENABLE_IIS_REWRITES']) || ($_SERVER['ENABLE_IIS_REWRITES'] != 1)) {
/*
* Unset headers used by IIS URL rewrites.
*/
unset($_SERVER['HTTP_X_REWRITE_URL']);
unset($_SERVER['HTTP_X_ORIGINAL_URL']);
unset($_SERVER['IIS_WasUrlRewritten']);
unset($_SERVER['UNENCODED_URL']);
unset($_SERVER['ORIG_PATH_INFO']);
}

if (!empty($_SERVER['MAGE_PROFILER'])
&& isset($_SERVER['HTTP_ACCEPT'])
&& strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdminNotification/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-admin-notification",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-backend": "100.2.*",
"magento/module-media-storage": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdvancedPricingImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-advanced-pricing-import-export",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-catalog": "101.1.*",
"magento/module-catalog-inventory": "100.2.*",
"magento/module-eav": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorization/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-authorization",
"description": "Authorization module provides access to Magento ACL functionality.",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-backend": "100.2.*",
"magento/framework": "100.2.*"
},
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorizenet/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-authorizenet",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-sales": "100.2.*",
"magento/module-store": "100.2.*",
"magento/module-quote": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-backend",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-directory": "100.2.*",
"magento/module-developer": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-backup",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-backend": "100.2.*",
"magento/module-cron": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Braintree/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-braintree",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/framework": "100.2.*",
"magento/magento-composer-installer": "*",
"magento/module-config": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-bundle",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-catalog": "101.1.*",
"magento/module-tax": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/BundleImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-bundle-import-export",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-catalog": "101.1.*",
"magento/module-import-export": "100.2.*",
"magento/module-catalog-import-export": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CacheInvalidate/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-cache-invalidate",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-page-cache": "100.2.*",
"magento/framework": "100.2.*"
},
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Captcha/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-captcha",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-customer": "100.2.*",
"magento/module-checkout": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-catalog",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-eav": "100.2.*",
"magento/module-cms": "101.1.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-catalog-import-export",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-catalog": "101.1.*",
"magento/module-catalog-url-rewrite": "100.2.*",
"magento/module-eav": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogInventory/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-catalog-inventory",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-config": "100.2.*",
"magento/module-store": "100.2.*",
"magento/module-catalog": "101.1.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogRule/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-catalog-rule",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-rule": "100.2.*",
"magento/module-catalog": "101.1.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogRuleConfigurable/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-catalog-rule-configurable",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-configurable-product": "100.2.*",
"magento/framework": "100.2.*",
"magento/module-catalog": "101.1.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogSearch/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-catalog-search",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-catalog": "101.1.*",
"magento/module-search": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogUrlRewrite/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-catalog-url-rewrite",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-backend": "100.2.*",
"magento/module-catalog": "101.1.*",
"magento/module-catalog-import-export": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogWidget/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-catalog-widget",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-catalog": "101.1.*",
"magento/module-widget": "100.2.*",
"magento/module-backend": "100.2.*",
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Checkout/Controller/Cart/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function execute()
}

$params = $this->getRequest()->getParams();

try {
if (isset($params['qty'])) {
$filter = new \Zend_Filter_LocalizedToNormalized(
Expand Down
30 changes: 27 additions & 3 deletions app/code/Magento/Checkout/Model/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ class Cart extends DataObject implements CartInterface
*/
protected $productRepository;

/**
* @var \Magento\Checkout\Model\Cart\RequestInfoFilterInterface
*/
private $requestInfoFilter;

/**
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
Expand Down Expand Up @@ -315,18 +320,22 @@ protected function _getProduct($productInfo)
*
* @param \Magento\Framework\DataObject|int|array $requestInfo
* @return \Magento\Framework\DataObject
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _getProductRequest($requestInfo)
{
if ($requestInfo instanceof \Magento\Framework\DataObject) {
$request = $requestInfo;
} elseif (is_numeric($requestInfo)) {
$request = new \Magento\Framework\DataObject(['qty' => $requestInfo]);
} else {
} elseif (is_array($requestInfo)) {
$request = new \Magento\Framework\DataObject($requestInfo);
} else {
throw new \Magento\Framework\Exception\LocalizedException(
__('We found an invalid request for adding product to quote.')
);
}

!$request->hasFormKey() ?: $request->unsFormKey();
$this->getRequestInfoFilter()->filter($request);

return $request;
}
Expand Down Expand Up @@ -722,4 +731,19 @@ public function updateItem($itemId, $requestInfo = null, $updatingParams = null)
$this->_checkoutSession->setLastAddedProductId($productId);
return $result;
}

/**
* Getter for RequestInfoFilter
*
* @deprecated
* @return \Magento\Checkout\Model\Cart\RequestInfoFilterInterface
*/
private function getRequestInfoFilter()
{
if ($this->requestInfoFilter === null) {
$this->requestInfoFilter = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Checkout\Model\Cart\RequestInfoFilterInterface::class);
}
return $this->requestInfoFilter;
}
}
44 changes: 44 additions & 0 deletions app/code/Magento/Checkout/Model/Cart/RequestInfoFilter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
*
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Checkout\Model\Cart;

/**
* Class RequestInfoFilter used for filtering data from a request
*/
class RequestInfoFilter implements RequestInfoFilterInterface
{
/**
* @var array $params
*/
private $filterList;

/**
* @param array $filterList
*/
public function __construct(
array $filterList = []
) {
$this->filterList = $filterList;
}

/**
* Filters the data with values from filterList
*
* @param \Magento\Framework\DataObject $params
* @return $this
*/
public function filter(\Magento\Framework\DataObject $params)
{
foreach ($this->filterList as $filterKey) {
/** @var string $filterKey */
if ($params->hasData($filterKey)) {
$params->unsetData($filterKey);
}
}
return $this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
*
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Checkout\Model\Cart;

/**
* Class RequestInfoFilterComposite
*/
class RequestInfoFilterComposite implements RequestInfoFilterInterface
{
/**
* @var RequestInfoFilter[] $params
*/
private $filters = [];

/**
* @param RequestInfoFilter[] $filters
*/
public function __construct(
$filters = []
) {
$this->filters = $filters;
}

/**
* Loops through all leafs of the composite and calls filter method
*
* @param \Magento\Framework\DataObject $params
* @return $this
*/
public function filter(\Magento\Framework\DataObject $params)
{
foreach ($this->filters as $filter) {
$filter->filter($params);
}
return $this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
*
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Checkout\Model\Cart;

/**
* Interface RequestInfoFilterInterface used by composite and leafs to implement filtering
*/
interface RequestInfoFilterInterface
{
/**
* Filters the data object by an array of parameters
*
* @param \Magento\Framework\DataObject $params
* @return RequestInfoFilterInterface
*/
public function filter(\Magento\Framework\DataObject $params);
}
Loading

0 comments on commit d9d75e8

Please sign in to comment.