Skip to content

Commit fd53a97

Browse files
author
Stanislav Idolov
committed
Merge remote-tracking branch 'mainline/develop' into bugs
2 parents 586a715 + 9130f67 commit fd53a97

File tree

8 files changed

+152
-108
lines changed

8 files changed

+152
-108
lines changed

app/code/Magento/Catalog/Model/Product/Image.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,7 @@ public function setBaseFile($file)
498498
$path = [
499499
$this->_catalogProductMediaConfig->getBaseMediaPath(),
500500
'cache',
501-
$this->_storeManager->getStore()->getId(),
502-
$path[] = $this->getDestinationSubdir(),
501+
$this->getDestinationSubdir(),
503502
];
504503
if (!empty($this->_width) || !empty($this->_height)) {
505504
$path[] = "{$this->_width}x{$this->_height}";

app/code/Magento/Catalog/Test/Unit/Model/Product/ImageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function testSetGetBaseFile()
180180
$this->image->setBaseFile('/somefile.png');
181181
$this->assertEquals('catalog/product/somefile.png', $this->image->getBaseFile());
182182
$this->assertEquals(
183-
'catalog/product/cache/1//beff4985b56e3afdbeabfc89641a4582/somefile.png',
183+
'catalog/product/cache//beff4985b56e3afdbeabfc89641a4582/somefile.png',
184184
$this->image->getNewFile()
185185
);
186186
}
@@ -302,7 +302,7 @@ public function testGetUrl()
302302
$this->testSetGetBaseFile();
303303
$url = $this->image->getUrl();
304304
$this->assertEquals(
305-
'http://magento.com/media/catalog/product/cache/1//beff4985b56e3afdbeabfc89641a4582/somefile.png',
305+
'http://magento.com/media/catalog/product/cache//beff4985b56e3afdbeabfc89641a4582/somefile.png',
306306
$url
307307
);
308308
}

app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ protected function _extractData(
7272
) {
7373
$metadataForm = $this->getMetadataForm($entityType, $formCode, $scope);
7474
$formData = $metadataForm->extractData($this->getRequest(), $scope);
75+
$formData = $metadataForm->compactData($formData);
7576

7677
// Initialize additional attributes
7778
/** @var \Magento\Framework\DataObject $object */
@@ -81,11 +82,6 @@ protected function _extractData(
8182
$formData[$attributeCode] = isset($requestData[$attributeCode]) ? $requestData[$attributeCode] : false;
8283
}
8384

84-
$result = $metadataForm->compactData($formData);
85-
86-
// Re-initialize additional attributes
87-
$formData = array_replace($result, $formData);
88-
8985
// Unset unused attributes
9086
$formAttributes = $metadataForm->getAttributes();
9187
foreach ($formAttributes as $attribute) {

app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php

Lines changed: 32 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -304,33 +304,28 @@ public function testExecuteWithExistentCustomer()
304304
],
305305
'subscription' => $subscription,
306306
];
307-
$filteredData = [
307+
$extractedData = [
308308
'entity_id' => $customerId,
309309
'code' => 'value',
310310
'coolness' => false,
311311
'disable_auto_group_change' => 'false',
312312
];
313-
$dataToCompact = [
313+
$compactedData = [
314314
'entity_id' => $customerId,
315315
'code' => 'value',
316316
'coolness' => false,
317317
'disable_auto_group_change' => 'false',
318-
CustomerInterface::DEFAULT_BILLING => false,
319-
CustomerInterface::DEFAULT_SHIPPING => false,
320-
'confirmation' => false,
321-
'sendemail_store_id' => false,
322-
'extension_attributes' => false,
318+
CustomerInterface::DEFAULT_BILLING => 2,
319+
CustomerInterface::DEFAULT_SHIPPING => 2
323320
];
324-
$addressFilteredData = [
321+
$addressExtractedData = [
325322
'entity_id' => $addressId,
326-
'default_billing' => 'true',
327-
'default_shipping' => 'true',
328323
'code' => 'value',
329324
'coolness' => false,
330325
'region' => 'region',
331326
'region_id' => 'region_id',
332327
];
333-
$addressDataToCompact = [
328+
$addressCompactedData = [
334329
'entity_id' => $addressId,
335330
'default_billing' => 'true',
336331
'default_shipping' => 'true',
@@ -430,11 +425,11 @@ public function testExecuteWithExistentCustomer()
430425
$customerFormMock->expects($this->once())
431426
->method('extractData')
432427
->with($this->requestMock, 'customer')
433-
->willReturn($filteredData);
428+
->willReturn($extractedData);
434429
$customerFormMock->expects($this->once())
435430
->method('compactData')
436-
->with($dataToCompact)
437-
->willReturn($filteredData);
431+
->with($extractedData)
432+
->willReturn($compactedData);
438433
$customerFormMock->expects($this->once())
439434
->method('getAttributes')
440435
->willReturn($attributes);
@@ -445,11 +440,11 @@ public function testExecuteWithExistentCustomer()
445440
$customerAddressFormMock->expects($this->once())
446441
->method('extractData')
447442
->with($this->requestMock, 'address/' . $addressId)
448-
->willReturn($addressFilteredData);
443+
->willReturn($addressExtractedData);
449444
$customerAddressFormMock->expects($this->once())
450445
->method('compactData')
451-
->with($addressDataToCompact)
452-
->willReturn($addressFilteredData);
446+
->with($addressExtractedData)
447+
->willReturn($addressCompactedData);
453448
$customerAddressFormMock->expects($this->once())
454449
->method('getAttributes')
455450
->willReturn($attributes);
@@ -625,8 +620,6 @@ public function testExecuteWithNewCustomer()
625620
'_template_' => '_template_',
626621
$addressId => [
627622
'entity_id' => $addressId,
628-
'default_billing' => 'false',
629-
'default_shipping' => 'false',
630623
'code' => 'value',
631624
'coolness' => false,
632625
'region' => 'region',
@@ -635,32 +628,12 @@ public function testExecuteWithNewCustomer()
635628
],
636629
'subscription' => $subscription,
637630
];
638-
$filteredData = [
631+
$extractedData = [
639632
'coolness' => false,
640633
'disable_auto_group_change' => 'false',
641634
];
642-
$dataToCompact = [
643-
'coolness' => false,
644-
'disable_auto_group_change' => 'false',
645-
CustomerInterface::DEFAULT_BILLING => false,
646-
CustomerInterface::DEFAULT_SHIPPING => false,
647-
'confirmation' => false,
648-
'sendemail_store_id' => false,
649-
'extension_attributes' => false,
650-
];
651-
$addressFilteredData = [
635+
$addressExtractedData = [
652636
'entity_id' => $addressId,
653-
'default_billing' => 'false',
654-
'default_shipping' => 'false',
655-
'code' => 'value',
656-
'coolness' => false,
657-
'region' => 'region',
658-
'region_id' => 'region_id',
659-
];
660-
$addressDataToCompact = [
661-
'entity_id' => $addressId,
662-
'default_billing' => 'false',
663-
'default_shipping' => 'false',
664637
'code' => 'value',
665638
'coolness' => false,
666639
'region' => 'region',
@@ -739,11 +712,11 @@ public function testExecuteWithNewCustomer()
739712
$customerFormMock->expects($this->once())
740713
->method('extractData')
741714
->with($this->requestMock, 'customer')
742-
->willReturn($filteredData);
715+
->willReturn($extractedData);
743716
$customerFormMock->expects($this->once())
744717
->method('compactData')
745-
->with($dataToCompact)
746-
->willReturn($filteredData);
718+
->with($extractedData)
719+
->willReturn($extractedData);
747720
$customerFormMock->expects($this->once())
748721
->method('getAttributes')
749722
->willReturn($attributes);
@@ -754,11 +727,11 @@ public function testExecuteWithNewCustomer()
754727
$customerAddressFormMock->expects($this->once())
755728
->method('extractData')
756729
->with($this->requestMock, 'address/' . $addressId)
757-
->willReturn($addressFilteredData);
730+
->willReturn($addressExtractedData);
758731
$customerAddressFormMock->expects($this->once())
759732
->method('compactData')
760-
->with($addressDataToCompact)
761-
->willReturn($addressFilteredData);
733+
->with($addressExtractedData)
734+
->willReturn($addressExtractedData);
762735
$customerAddressFormMock->expects($this->once())
763736
->method('getAttributes')
764737
->willReturn($attributes);
@@ -910,19 +883,10 @@ public function testExecuteWithNewCustomerAndValidationException()
910883
],
911884
'subscription' => $subscription,
912885
];
913-
$filteredData = [
886+
$extractedData = [
914887
'coolness' => false,
915888
'disable_auto_group_change' => 'false',
916889
];
917-
$dataToCompact = [
918-
'coolness' => false,
919-
'disable_auto_group_change' => 'false',
920-
CustomerInterface::DEFAULT_BILLING => false,
921-
CustomerInterface::DEFAULT_SHIPPING => false,
922-
'confirmation' => false,
923-
'sendemail_store_id' => false,
924-
'extension_attributes' => false,
925-
];
926890

927891
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
928892
$attributeMock = $this->getMockBuilder(
@@ -971,11 +935,11 @@ public function testExecuteWithNewCustomerAndValidationException()
971935
$customerFormMock->expects($this->once())
972936
->method('extractData')
973937
->with($this->requestMock, 'customer')
974-
->willReturn($filteredData);
938+
->willReturn($extractedData);
975939
$customerFormMock->expects($this->once())
976940
->method('compactData')
977-
->with($dataToCompact)
978-
->willReturn($filteredData);
941+
->with($extractedData)
942+
->willReturn($extractedData);
979943
$customerFormMock->expects($this->once())
980944
->method('getAttributes')
981945
->willReturn($attributes);
@@ -1062,19 +1026,10 @@ public function testExecuteWithNewCustomerAndLocalizedException()
10621026
],
10631027
'subscription' => $subscription,
10641028
];
1065-
$filteredData = [
1029+
$extractedData = [
10661030
'coolness' => false,
10671031
'disable_auto_group_change' => 'false',
10681032
];
1069-
$dataToCompact = [
1070-
'coolness' => false,
1071-
'disable_auto_group_change' => 'false',
1072-
CustomerInterface::DEFAULT_BILLING => false,
1073-
CustomerInterface::DEFAULT_SHIPPING => false,
1074-
'confirmation' => false,
1075-
'sendemail_store_id' => false,
1076-
'extension_attributes' => false,
1077-
];
10781033

10791034
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
10801035
$attributeMock = $this->getMockBuilder(
@@ -1124,11 +1079,11 @@ public function testExecuteWithNewCustomerAndLocalizedException()
11241079
$customerFormMock->expects($this->once())
11251080
->method('extractData')
11261081
->with($this->requestMock, 'customer')
1127-
->willReturn($filteredData);
1082+
->willReturn($extractedData);
11281083
$customerFormMock->expects($this->once())
11291084
->method('compactData')
1130-
->with($dataToCompact)
1131-
->willReturn($filteredData);
1085+
->with($extractedData)
1086+
->willReturn($extractedData);
11321087
$customerFormMock->expects($this->once())
11331088
->method('getAttributes')
11341089
->willReturn($attributes);
@@ -1214,18 +1169,9 @@ public function testExecuteWithNewCustomerAndException()
12141169
],
12151170
'subscription' => $subscription,
12161171
];
1217-
$filteredData = [
1218-
'coolness' => false,
1219-
'disable_auto_group_change' => 'false',
1220-
];
1221-
$dataToCompact = [
1172+
$extractedData = [
12221173
'coolness' => false,
12231174
'disable_auto_group_change' => 'false',
1224-
CustomerInterface::DEFAULT_BILLING => false,
1225-
CustomerInterface::DEFAULT_SHIPPING => false,
1226-
'confirmation' => false,
1227-
'sendemail_store_id' => false,
1228-
'extension_attributes' => false,
12291175
];
12301176

12311177
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
@@ -1275,11 +1221,11 @@ public function testExecuteWithNewCustomerAndException()
12751221
$customerFormMock->expects($this->once())
12761222
->method('extractData')
12771223
->with($this->requestMock, 'customer')
1278-
->willReturn($filteredData);
1224+
->willReturn($extractedData);
12791225
$customerFormMock->expects($this->once())
12801226
->method('compactData')
1281-
->with($dataToCompact)
1282-
->willReturn($filteredData);
1227+
->with($extractedData)
1228+
->willReturn($extractedData);
12831229
$customerFormMock->expects($this->once())
12841230
->method('getAttributes')
12851231
->willReturn($attributes);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ public function testInitiatePasswordResetEmailReminder()
11461146

11471147
$storeId = 1;
11481148

1149-
mt_srand(mt_rand() + (100000000 * microtime()) % PHP_INT_MAX);
1149+
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
11501150
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
11511151

11521152
$this->emailNotificationMock->expects($this->once())
@@ -1168,7 +1168,7 @@ public function testInitiatePasswordResetEmailReset()
11681168
$templateIdentifier = 'Template Identifier';
11691169
$sender = 'Sender';
11701170

1171-
mt_srand(mt_rand() + (100000000 * microtime()) % PHP_INT_MAX);
1171+
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
11721172
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
11731173

11741174
$this->emailNotificationMock->expects($this->once())
@@ -1194,7 +1194,7 @@ public function testInitiatePasswordResetNoTemplate()
11941194
$templateIdentifier = 'Template Identifier';
11951195
$sender = 'Sender';
11961196

1197-
mt_srand(mt_rand() + (100000000 * microtime()) % PHP_INT_MAX);
1197+
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
11981198
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
11991199

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

app/code/Magento/PageCache/Model/Config.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,17 @@ protected function _getReplacements()
148148
),
149149
'/* {{ ips }} */' => $this->_getAccessList(),
150150
'/* {{ design_exceptions_code }} */' => $this->_getDesignExceptions(),
151-
// http headers get transformed by php `X-Forwarded-Proto: https` becomes $SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'
151+
// http headers get transformed by php `X-Forwarded-Proto: https`
152+
// becomes $SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'
152153
// Apache and Nginx drop all headers with underlines by default.
153-
'/* {{ ssl_offloaded_header }} */' => str_replace('_', '-', $this->_scopeConfig->getValue(
154-
\Magento\Framework\HTTP\PhpEnvironment\Request::XML_PATH_OFFLOADER_HEADER,
155-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE))
156-
154+
'/* {{ ssl_offloaded_header }} */' => str_replace(
155+
'_',
156+
'-',
157+
$this->_scopeConfig->getValue(
158+
\Magento\Framework\HTTP\PhpEnvironment\Request::XML_PATH_OFFLOADER_HEADER,
159+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
160+
)
161+
)
157162
];
158163
}
159164

@@ -176,6 +181,7 @@ protected function _getAccessList()
176181
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
177182
);
178183
if (!empty($accessList)) {
184+
$result = [];
179185
$ips = explode(',', $accessList);
180186
foreach ($ips as $ip) {
181187
$result[] = sprintf($tpl, trim($ip));

lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
/**
3-
*
43
* Copyright © 2016 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Framework\ObjectManager\Config;
87

8+
use Magento\Framework\ObjectManager\ConfigInterface;
99
use Magento\Framework\ObjectManager\ConfigCacheInterface;
1010
use Magento\Framework\ObjectManager\RelationsInterface;
1111

12-
class Compiled implements \Magento\Framework\ObjectManager\ConfigInterface
12+
class Compiled implements ConfigInterface
1313
{
1414
/**
1515
* @var array
@@ -129,9 +129,15 @@ public function getPreference($type)
129129
*/
130130
public function extend(array $configuration)
131131
{
132-
$this->arguments = $configuration['arguments'];
133-
$this->virtualTypes = $configuration['instanceTypes'];
134-
$this->preferences = $configuration['preferences'];
132+
$this->arguments = isset($configuration['arguments'])
133+
? array_replace($this->arguments, $configuration['arguments'])
134+
: $this->arguments;
135+
$this->virtualTypes = isset($configuration['instanceTypes'])
136+
? array_replace($this->virtualTypes, $configuration['instanceTypes'])
137+
: $this->virtualTypes;
138+
$this->preferences = isset($configuration['preferences'])
139+
? array_replace($this->preferences, $configuration['preferences'])
140+
: $this->preferences;
135141
}
136142

137143
/**

0 commit comments

Comments
 (0)