Skip to content

Commit 723ba59

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #9347: Zend feed refactoring (by @ldusan84) - #15154: [Forwardport] Fixed documentation about viewModels (by @dmytro-ch) - #15143: [Forwardport] chore: checkout last 5 commits (by @mzeis) - #15123: [Forwardport] small optimization in if-condition (by @mzeis) - #15071: [Forwardport] Add statement to 'beforeSave' method to allow app:config:import (by @adrian-martinez-interactiv4) - #15070: [Forwardport] Duplicate Order Confirmation Emails for PayPal Express checkout order (by @adrian-martinez-interactiv4) - #15063: [2.3-develop][Forwardport] #7822 Empty Checkout Agreement Edit Form when Single Store Mode is enabled (by @gwharton) - #14429: [ForwardPort 2.3-develop] Fix \Magento\Checkout\Controller\Index\Index::isSecureRequest method to take care of current request being secure and also from referer, as stated in phpdoc block (by @adrian-martinez-interactiv4) Fixed GitHub Issues: - #9240: Upgrade ZF components. Zend_Feed (reported by @okorshenko) has been fixed in #9347 by @ldusan84 in 2.3-develop branch Related commits: 1. ca9e582 2. ed33b18 3. c7ba65a 4. 9d0a290 5. 109047f 6. 4534a2e 7. c413389 8. caa4471 9. 66154e6 10. 49bcf98 11. c0b4c7a 12. 411d0fc 13. 9779ebe 14. eba92d0 15. 983d74f 16. 0b51e8c 17. 74d431a 18. 7f73d67 19. 2933223 20. 64610d3 21. d2d397a 22. 0770227 23. 735c840 24. 7e17d20 25. 46c51ba 26. 3a3683f 27. 6311d5c 28. 4462eaf - #7822: Empty Checkout Agreement Edit Form when Single Store Mode is enabled (reported by @RedEnzian) has been fixed in #15063 by @gwharton in 2.3-develop branch Related commits: 1. d61fe1d 2. 9c4a26f 3. 76be1b9 - #4301: Hit fast twice F5 on checout page, customer loggs out automatically (reported by @daniel-ifrim) has been fixed in #14429 by @adrian-martinez-interactiv4 in 2.3-develop branch Related commits: 1. f82a175 2. 4d23b8b - #12362: Concurrent (quick reload) requests on checkout cause cart to empty - related to session_regenerate_id (reported by @minlare) has been fixed in #14429 by @adrian-martinez-interactiv4 in 2.3-develop branch Related commits: 1. f82a175 2. 4d23b8b - #13427: [2.1.11] Add to cart, try to checkout, cart is empty but mini-cart has items. (reported by @aeu) has been fixed in #14429 by @adrian-martinez-interactiv4 in 2.3-develop branch Related commits: 1. f82a175 2. 4d23b8b
2 parents fdaa419 + 52f5c4c commit 723ba59

File tree

16 files changed

+514
-90
lines changed

16 files changed

+514
-90
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ language: php
1818
php:
1919
- 7.1
2020
- 7.2
21+
git:
22+
depth: 5
2123
env:
2224
global:
2325
- COMPOSER_BIN_DIR=~/bin

app/code/Magento/Backend/Block/Template.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Backend\Block;
710

811
/**
@@ -17,10 +20,12 @@
1720
* Example:
1821
* <block name="my.block" class="Magento\Backend\Block\Template" template="My_Module::template.phtml" >
1922
* <arguments>
20-
* <argument name="viewModel" xsi:type="object">My\Module\ViewModel\Custom</argument>
23+
* <argument name="view_model" xsi:type="object">My\Module\ViewModel\Custom</argument>
2124
* </arguments>
2225
* </block>
2326
*
27+
* Your class object can then be accessed by doing $block->getViewModel()
28+
*
2429
* @api
2530
* @SuppressWarnings(PHPMD.NumberOfChildren)
2631
* @since 100.0.2

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/AttributeFilter.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper;
710

811
use \Magento\Catalog\Model\Product;
@@ -28,14 +31,25 @@ class AttributeFilter
2831
public function prepareProductAttributes(Product $product, array $productData, array $useDefaults)
2932
{
3033
foreach ($productData as $attribute => $value) {
31-
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
32-
if ($value === '' && $considerUseDefaultsAttribute) {
33-
/** @var $product Product */
34-
if ((bool)$product->getData($attribute) === (bool)$value) {
35-
unset($productData[$attribute]);
36-
}
34+
if ($this->isAttributeShouldNotBeUpdated($product, $useDefaults, $attribute, $value)) {
35+
unset($productData[$attribute]);
3736
}
3837
}
38+
3939
return $productData;
4040
}
41+
42+
/**
43+
* @param Product $product
44+
* @param $useDefaults
45+
* @param $attribute
46+
* @param $value
47+
* @return bool
48+
*/
49+
private function isAttributeShouldNotBeUpdated(Product $product, $useDefaults, $attribute, $value) : bool
50+
{
51+
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
52+
53+
return ($value === '' && $considerUseDefaultsAttribute && !$product->getData($attribute));
54+
}
4155
}

app/code/Magento/Checkout/Controller/Index/Index.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
8+
declare(strict_types=1);
9+
710
namespace Magento\Checkout\Controller\Index;
811

912
class Index extends \Magento\Checkout\Controller\Onepage
@@ -32,11 +35,35 @@ public function execute()
3235
return $this->resultRedirectFactory->create()->setPath('checkout/cart');
3336
}
3437

35-
$this->_customerSession->regenerateId();
38+
// generate session ID only if connection is unsecure according to issues in session_regenerate_id function.
39+
// @see http://php.net/manual/en/function.session-regenerate-id.php
40+
if (!$this->isSecureRequest()) {
41+
$this->_customerSession->regenerateId();
42+
}
3643
$this->_objectManager->get(\Magento\Checkout\Model\Session::class)->setCartWasUpdated(false);
3744
$this->getOnepage()->initCheckout();
3845
$resultPage = $this->resultPageFactory->create();
3946
$resultPage->getConfig()->getTitle()->set(__('Checkout'));
4047
return $resultPage;
4148
}
49+
50+
/**
51+
* Checks if current request uses SSL and referer also is secure.
52+
*
53+
* @return bool
54+
*/
55+
private function isSecureRequest(): bool
56+
{
57+
$request = $this->getRequest();
58+
59+
$referrer = $request->getHeader('referer');
60+
$secure = false;
61+
62+
if ($referrer) {
63+
$scheme = parse_url($referrer, PHP_URL_SCHEME);
64+
$secure = $scheme === 'https';
65+
}
66+
67+
return $secure && $request->isSecure();
68+
}
4269
}

0 commit comments

Comments
 (0)