Skip to content

Commit 2a337f9

Browse files
author
Oleksandr Iegorov
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into 2.3-develop-mattijv
2 parents 3d19c09 + 729650d commit 2a337f9

File tree

69 files changed

+2129
-222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2129
-222
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4136,7 +4136,7 @@ Tests:
41364136
* Moved Multishipping functionality to newly created module Multishipping
41374137
* Extracted Product duplication behavior from Product model to Product\Copier model
41384138
* Replaced event "catalog_model_product_duplicate" with composite Product\Copier model
4139-
* Replaced event "catalog_product_prepare_save" with controller product initialization helper that can be customozed via plugins
4139+
* Replaced event "catalog_product_prepare_save" with controller product initialization helper that can be customized via plugins
41404140
* Consolidated Authorize.Net functionality in single module Authorizenet
41414141
* Eliminated dependency of Sales module on Shipping and Usa modules
41424142
* Eliminated dependency of Shipping module on Customer module

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Please review the [Code Contributions guide](https://devdocs.magento.com/guides/
4545

4646
## Reporting Security Issues
4747

48-
To report security vulnerabilities in Magento software or web sites, please create a Bugcrowd researcher account [there](https://bugcrowd.com/magento) to submit and follow-up your issue. Learn more about reporting security issues [here](https://magento.com/security/reporting-magento-security-issue).
48+
To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the [Magento Bug Bounty Program](https://hackerone.com/magento) on hackerone. Please create a hackerone account [there](https://hackerone.com/magento) to submit and follow-up your issue.
4949

5050
Stay up-to-date on the latest security news and patches for Magento by signing up for [Security Alert Notifications](https://magento.com/security/sign-up).
5151

app/bootstrap.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
* Environment initialization
99
*/
1010
error_reporting(E_ALL);
11-
stream_wrapper_unregister('phar');
11+
if (in_array('phar', \stream_get_wrappers())) {
12+
stream_wrapper_unregister('phar');
13+
}
1214
#ini_set('display_errors', 1);
1315

1416
/* PHP version validation */

app/code/Magento/Braintree/Controller/Paypal/PlaceOrder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function execute()
7575
$this->logger->critical($e);
7676
$this->messageManager->addExceptionMessage(
7777
$e,
78-
'The order #' . $quote->getReservedOrderId() . ' cannot be processed.'
78+
__('The order #%1 cannot be processed.', $quote->getReservedOrderId())
7979
);
8080
}
8181

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Extend.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
namespace Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes;
8+
79
/**
8-
* Bundle Extended Attribures Block
10+
* Bundle Extended Attribures Block.
911
*
10-
* @author Magento Core Team <core@magentocommerce.com>
12+
* @author Magento Core Team <core@magentocommerce.com>
1113
*/
12-
namespace Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes;
13-
1414
class Extend extends \Magento\Catalog\Block\Adminhtml\Form\Renderer\Fieldset\Element
1515
{
1616
/**
@@ -75,7 +75,7 @@ public function getElementHtml()
7575
}
7676

7777
/**
78-
* Execute method getElementHtml from parrent class
78+
* Execute method getElementHtml from parent class
7979
*
8080
* @return string
8181
*/
@@ -85,6 +85,8 @@ public function getParentElementHtml()
8585
}
8686

8787
/**
88+
* Get options.
89+
*
8890
* @return array
8991
*/
9092
public function getOptions()
@@ -106,6 +108,8 @@ public function getOptions()
106108
}
107109

108110
/**
111+
* Is disabled field.
112+
*
109113
* @return bool
110114
*/
111115
public function isDisabledField()
@@ -118,6 +122,8 @@ public function isDisabledField()
118122
}
119123

120124
/**
125+
* Get product.
126+
*
121127
* @return mixed
122128
*/
123129
public function getProduct()
@@ -129,6 +135,8 @@ public function getProduct()
129135
}
130136

131137
/**
138+
* Get extended element.
139+
*
132140
* @param string $switchAttributeCode
133141
* @return \Magento\Framework\Data\Form\Element\Select
134142
* @throws \Magento\Framework\Exception\LocalizedException

app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public function __construct(
6969

7070
/**
7171
* Overloaded method for getting list of bundle options
72+
*
7273
* Caches result in quote item, because it can be used in cart 'recent view' and on same page in cart checkout
7374
*
7475
* @return array
@@ -88,7 +89,7 @@ public function getMessages()
8889
$messages = [];
8990
$quoteItem = $this->getItem();
9091

91-
// Add basic messages occuring during this page load
92+
// Add basic messages occurring during this page load
9293
$baseMessages = $quoteItem->getMessage(false);
9394
if ($baseMessages) {
9495
foreach ($baseMessages as $message) {

app/code/Magento/ConfigurableProduct/Setup/Patch/Data/InstallInitialConfigurableAttributes.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
namespace Magento\ConfigurableProduct\Setup\Patch\Data;
88

9+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
910
use Magento\Eav\Setup\EavSetup;
1011
use Magento\Eav\Setup\EavSetupFactory;
11-
use Magento\Framework\App\ResourceConnection;
1212
use Magento\Framework\Setup\ModuleDataSetupInterface;
1313
use Magento\Framework\Setup\Patch\DataPatchInterface;
1414
use Magento\Framework\Setup\Patch\PatchVersionInterface;
15-
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1615

1716
/**
1817
* Class InstallInitialConfigurableAttributes
18+
*
1919
* @package Magento\ConfigurableProduct\Setup\Patch
2020
*/
2121
class InstallInitialConfigurableAttributes implements DataPatchInterface, PatchVersionInterface
@@ -24,6 +24,7 @@ class InstallInitialConfigurableAttributes implements DataPatchInterface, PatchV
2424
* @var ModuleDataSetupInterface
2525
*/
2626
private $moduleDataSetup;
27+
2728
/**
2829
* @var EavSetupFactory
2930
*/
@@ -43,7 +44,7 @@ public function __construct(
4344
}
4445

4546
/**
46-
* {@inheritdoc}
47+
* @inheritdoc
4748
*/
4849
public function apply()
4950
{
@@ -64,40 +65,43 @@ public function apply()
6465
'color'
6566
];
6667
foreach ($attributes as $attributeCode) {
67-
$relatedProductTypes = explode(
68-
',',
69-
$eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to')
70-
);
71-
if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
72-
$relatedProductTypes[] = Configurable::TYPE_CODE;
73-
$eavSetup->updateAttribute(
74-
\Magento\Catalog\Model\Product::ENTITY,
75-
$attributeCode,
76-
'apply_to',
77-
implode(',', $relatedProductTypes)
68+
$attribute = $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to');
69+
if ($attribute) {
70+
$relatedProductTypes = explode(
71+
',',
72+
$attribute
7873
);
74+
if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
75+
$relatedProductTypes[] = Configurable::TYPE_CODE;
76+
$eavSetup->updateAttribute(
77+
\Magento\Catalog\Model\Product::ENTITY,
78+
$attributeCode,
79+
'apply_to',
80+
implode(',', $relatedProductTypes)
81+
);
82+
}
7983
}
8084
}
8185
}
8286

8387
/**
84-
* {@inheritdoc}
88+
* @inheritdoc
8589
*/
8690
public static function getDependencies()
8791
{
8892
return [];
8993
}
9094

9195
/**
92-
* {@inheritdoc}
96+
* @inheritdoc
9397
*/
9498
public static function getVersion()
9599
{
96100
return '2.0.0';
97101
}
98102

99103
/**
100-
* {@inheritdoc}
104+
* @inheritdoc
101105
*/
102106
public function getAliases()
103107
{

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,6 @@ public function initiatePasswordReset($email, $template, $websiteId = null)
624624
* @param string $rpToken
625625
* @throws ExpiredException
626626
* @throws NoSuchEntityException
627-
*
628627
* @return CustomerInterface
629628
* @throws LocalizedException
630629
*/
@@ -703,7 +702,12 @@ public function resetPassword($email, $resetToken, $newPassword)
703702
$customerSecure->setRpTokenCreatedAt(null);
704703
$customerSecure->setPasswordHash($this->createPasswordHash($newPassword));
705704
$this->destroyCustomerSessions($customer->getId());
706-
$this->sessionManager->destroy();
705+
if ($this->sessionManager->isSessionExists()) {
706+
//delete old session and move data to the new session
707+
//use this instead of $this->sessionManager->regenerateId because last one doesn't delete old session
708+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
709+
session_regenerate_id(true);
710+
}
707711
$this->customerRepository->save($customer);
708712

709713
return true;
@@ -1564,6 +1568,7 @@ private function getEmailNotification()
15641568

15651569
/**
15661570
* Destroy all active customer sessions by customer id (current session will not be destroyed).
1571+
*
15671572
* Customer sessions which should be deleted are collecting from the "customer_visitor" table considering
15681573
* configured session lifetime.
15691574
*

app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerActionGroup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="CustomerLogoutStorefrontByMenuItemsActionGroup">
12-
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcome}}"
13-
dependentSelector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}"
12+
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}"
13+
dependentSelector="{{StorefrontPanelHeaderSection.customerLogoutLink}}"
1414
visible="false"
1515
stepKey="clickHeaderCustomerMenuButton" />
1616
<click selector="{{StorefrontPanelHeaderSection.customerLogoutLink}}" stepKey="clickSignOutButton" />

app/code/Magento/Customer/Test/Mftf/Section/StorefrontPanelHeaderSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<element name="welcomeMessage" type="text" selector="header>.panel .greet.welcome" />
1616
<element name="createAnAccountLink" type="select" selector="//div[@class='panel wrapper']//li/a[contains(.,'Create an Account')]" timeout="30"/>
1717
<element name="notYouLink" type="button" selector=".greet.welcome span a"/>
18-
<element name="customerWelcome" type="text" selector=".panel.header .customer-welcome"/>
19-
<element name="customerWelcomeMenu" type="text" selector=".panel.header .customer-welcome .customer-menu"/>
18+
<element name="customerWelcome" type="text" selector=".panel.header .greet.welcome"/>
19+
<element name="customerWelcomeMenu" type="text" selector=".panel.header .customer-welcome .customer-name"/>
2020
<element name="customerLoginLink" type="button" selector=".panel.header .header.links .authorization-link a" timeout="30"/>
2121
<element name="customerLogoutLink" type="text" selector=".panel.header .customer-welcome .customer-menu .authorization-link a" timeout="30"/>
2222
</section>

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,7 @@ public function testInitiatePasswordResetEmailReminder()
12381238

12391239
$storeId = 1;
12401240

1241-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1242-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1241+
$hash = hash('sha256', microtime() . random_int(PHP_INT_MIN, PHP_INT_MAX));
12431242

12441243
$this->emailNotificationMock->expects($this->once())
12451244
->method('passwordReminder')
@@ -1263,8 +1262,7 @@ public function testInitiatePasswordResetEmailReset()
12631262
$templateIdentifier = 'Template Identifier';
12641263
$sender = 'Sender';
12651264

1266-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1267-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1265+
$hash = hash('sha256', microtime() . random_int(PHP_INT_MIN, PHP_INT_MAX));
12681266

12691267
$this->emailNotificationMock->expects($this->once())
12701268
->method('passwordResetConfirmation')
@@ -1288,8 +1286,7 @@ public function testInitiatePasswordResetNoTemplate()
12881286
$templateIdentifier = 'Template Identifier';
12891287
$sender = 'Sender';
12901288

1291-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1292-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1289+
$hash = hash('sha256', microtime() . random_int(PHP_INT_MIN, PHP_INT_MAX));
12931290

12941291
$this->prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash);
12951292

@@ -1610,7 +1607,7 @@ function ($string) {
16101607
$this->customerSecure->expects($this->once())->method('setRpTokenCreatedAt')->with(null);
16111608
$this->customerSecure->expects($this->any())->method('setPasswordHash')->willReturn(null);
16121609

1613-
$this->sessionManager->expects($this->atLeastOnce())->method('destroy');
1610+
$this->sessionManager->method('isSessionExists')->willReturn(false);
16141611
$this->sessionManager->expects($this->atLeastOnce())->method('getSessionId');
16151612
$visitor = $this->getMockBuilder(\Magento\Customer\Model\Visitor::class)
16161613
->disableOriginalConstructor()

app/code/Magento/Customer/view/frontend/templates/account/customer.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
data-toggle="dropdown"
1717
data-trigger-keypress-button="true"
1818
data-bind="scope: 'customer'">
19-
<span data-bind="text: customer().fullname"></span>
2019
<button type="button"
2120
class="action switch"
2221
tabindex="-1"

app/code/Magento/Dhl/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<field id="account" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
3232
<label>Account Number</label>
3333
</field>
34-
<field id="content_type" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
34+
<field id="content_type" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
3535
<label>Content Type (Non Domestic)</label>
3636
<comment>Whether to use Documents or NonDocuments service for non domestic shipments. (Shipments within the EU are classed as domestic)</comment>
3737
<source_model>Magento\Dhl\Model\Source\Contenttype</source_model>

app/code/Magento/Dhl/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Title,Title
6161
Password,Password
6262
"Account Number","Account Number"
6363
"Content Type","Content Type"
64+
"Whether to use Documents or NonDocuments service for non domestic shipments. (Shipments within the EU are classed as domestic)","Whether to use Documents or NonDocuments service for non domestic shipments. (Shipments within the EU are classed as domestic)"
6465
"Calculate Handling Fee","Calculate Handling Fee"
6566
"Handling Applied","Handling Applied"
6667
"""Per Order"" allows a single handling fee for the entire order. ""Per Package"" allows an individual handling fee for each package.","""Per Order"" allows a single handling fee for the entire order. ""Per Package"" allows an individual handling fee for each package."

app/code/Magento/Downloadable/Observer/SaveDownloadableOrderItemObserver.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Magento\Store\Model\ScopeInterface;
1010

1111
/**
12+
* Saves data from order to purchased links.
13+
*
1214
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1315
*/
1416
class SaveDownloadableOrderItemObserver implements ObserverInterface
@@ -92,9 +94,15 @@ public function execute(\Magento\Framework\Event\Observer $observer)
9294
if ($purchasedLink->getId()) {
9395
return $this;
9496
}
97+
$storeId = $orderItem->getOrder()->getStoreId();
98+
$orderStatusToEnableItem = $this->_scopeConfig->getValue(
99+
\Magento\Downloadable\Model\Link\Purchased\Item::XML_PATH_ORDER_ITEM_STATUS,
100+
ScopeInterface::SCOPE_STORE,
101+
$storeId
102+
);
95103
if (!$product) {
96104
$product = $this->_createProductModel()->setStoreId(
97-
$orderItem->getOrder()->getStoreId()
105+
$storeId
98106
)->load(
99107
$orderItem->getProductId()
100108
);
@@ -150,6 +158,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
150158
)->setNumberOfDownloadsBought(
151159
$numberOfDownloads
152160
)->setStatus(
161+
\Magento\Sales\Model\Order\Item::STATUS_PENDING == $orderStatusToEnableItem ?
162+
\Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_AVAILABLE :
153163
\Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_PENDING
154164
)->setCreatedAt(
155165
$orderItem->getCreatedAt()
@@ -165,6 +175,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
165175
}
166176

167177
/**
178+
* Create purchased model.
179+
*
168180
* @return \Magento\Downloadable\Model\Link\Purchased
169181
*/
170182
protected function _createPurchasedModel()
@@ -173,6 +185,8 @@ protected function _createPurchasedModel()
173185
}
174186

175187
/**
188+
* Create product model.
189+
*
176190
* @return \Magento\Catalog\Model\Product
177191
*/
178192
protected function _createProductModel()
@@ -181,6 +195,8 @@ protected function _createProductModel()
181195
}
182196

183197
/**
198+
* Create purchased item model.
199+
*
184200
* @return \Magento\Downloadable\Model\Link\Purchased\Item
185201
*/
186202
protected function _createPurchasedItemModel()
@@ -189,6 +205,8 @@ protected function _createPurchasedItemModel()
189205
}
190206

191207
/**
208+
* Create items collection.
209+
*
192210
* @return \Magento\Downloadable\Model\ResourceModel\Link\Purchased\Item\Collection
193211
*/
194212
protected function _createItemsCollection()

0 commit comments

Comments
 (0)