Skip to content

Commit c85abb4

Browse files
committed
Merge branch '2.1-develop' of https://github.com/magento/magento2ce into MAGETWO-70329-2
2 parents e9550f6 + 70bd853 commit c85abb4

File tree

22 files changed

+135
-51
lines changed

22 files changed

+135
-51
lines changed

app/code/Magento/Checkout/CustomerData/DefaultItem.php

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

77
namespace Magento\Checkout\CustomerData;
88

9+
use Magento\Framework\App\ObjectManager;
10+
911
/**
1012
* Default item
1113
*/
@@ -36,26 +38,36 @@ class DefaultItem extends AbstractItem
3638
*/
3739
protected $checkoutHelper;
3840

41+
/**
42+
* Escaper
43+
*
44+
* @var \Magento\Framework\Escaper
45+
*/
46+
private $escaper;
47+
3948
/**
4049
* @param \Magento\Catalog\Helper\Image $imageHelper
4150
* @param \Magento\Msrp\Helper\Data $msrpHelper
4251
* @param \Magento\Framework\UrlInterface $urlBuilder
4352
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
4453
* @param \Magento\Checkout\Helper\Data $checkoutHelper
54+
* @param \Magento\Framework\Escaper|null $escaper
4555
* @codeCoverageIgnore
4656
*/
4757
public function __construct(
4858
\Magento\Catalog\Helper\Image $imageHelper,
4959
\Magento\Msrp\Helper\Data $msrpHelper,
5060
\Magento\Framework\UrlInterface $urlBuilder,
5161
\Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool,
52-
\Magento\Checkout\Helper\Data $checkoutHelper
62+
\Magento\Checkout\Helper\Data $checkoutHelper,
63+
\Magento\Framework\Escaper $escaper = null
5364
) {
5465
$this->configurationPool = $configurationPool;
5566
$this->imageHelper = $imageHelper;
5667
$this->msrpHelper = $msrpHelper;
5768
$this->urlBuilder = $urlBuilder;
5869
$this->checkoutHelper = $checkoutHelper;
70+
$this->escaper = $escaper ?: ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class);
5971
}
6072

6173
/**
@@ -64,14 +76,16 @@ public function __construct(
6476
protected function doGetItemData()
6577
{
6678
$imageHelper = $this->imageHelper->init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail');
79+
$productName = $this->escaper->escapeHtml($this->item->getProduct()->getName());
80+
6781
return [
6882
'options' => $this->getOptionList(),
6983
'qty' => $this->item->getQty() * 1,
7084
'item_id' => $this->item->getId(),
7185
'configure_url' => $this->getConfigureUrl(),
7286
'is_visible_in_site_visibility' => $this->item->getProduct()->isVisibleInSiteVisibility(),
7387
'product_id' => $this->item->getProduct()->getId(),
74-
'product_name' => $this->item->getProduct()->getName(),
88+
'product_name' => $productName,
7589
'product_sku' => $this->item->getProduct()->getSku(),
7690
'product_url' => $this->getProductUrl(),
7791
'product_has_url' => $this->hasProductUrl(),

app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</span>
2626
</a>
2727
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
28-
<div class="block block-minicart empty"
28+
<div class="block block-minicart"
2929
data-role="dropdownDialog"
3030
data-mage-init='{"dropdownDialog":{
3131
"appendTo":"[data-block=minicart]",

app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div class="product-item-details">
2525
<strong class="product-item-name">
2626
<!-- ko if: product_has_url -->
27-
<a data-bind="attr: {href: product_url}, text: product_name"></a>
27+
<a data-bind="attr: {href: product_url}, html: product_name"></a>
2828
<!-- /ko -->
2929
<!-- ko ifnot: product_has_url -->
3030
<!-- ko text: product_name --><!-- /ko -->

app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@ class ConfigurableItem extends DefaultItem
2626
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
2727
* @param \Magento\Checkout\Helper\Data $checkoutHelper
2828
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
29+
* @param \Magento\Framework\Escaper|null $escaper
2930
*/
3031
public function __construct(
3132
\Magento\Catalog\Helper\Image $imageHelper,
3233
\Magento\Msrp\Helper\Data $msrpHelper,
3334
\Magento\Framework\UrlInterface $urlBuilder,
3435
\Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool,
3536
\Magento\Checkout\Helper\Data $checkoutHelper,
36-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
37+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
38+
\Magento\Framework\Escaper $escaper = null
3739
) {
3840
parent::__construct(
3941
$imageHelper,
4042
$msrpHelper,
4143
$urlBuilder,
4244
$configurationPool,
43-
$checkoutHelper
45+
$checkoutHelper,
46+
$escaper
4447
);
4548
$this->_scopeConfig = $scopeConfig;
4649
}

app/code/Magento/GroupedProduct/CustomerData/GroupedItem.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,24 @@ class GroupedItem extends DefaultItem
2222
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
2323
* @param \Magento\Checkout\Helper\Data $checkoutHelper
2424
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
25+
* @param \Magento\Framework\Escaper|null $escaper
2526
*/
2627
public function __construct(
2728
\Magento\Catalog\Helper\Image $imageHelper,
2829
\Magento\Msrp\Helper\Data $msrpHelper,
2930
\Magento\Framework\UrlInterface $urlBuilder,
3031
\Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool,
3132
\Magento\Checkout\Helper\Data $checkoutHelper,
32-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
33+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
34+
\Magento\Framework\Escaper $escaper = null
3335
) {
3436
parent::__construct(
3537
$imageHelper,
3638
$msrpHelper,
3739
$urlBuilder,
3840
$configurationPool,
39-
$checkoutHelper
41+
$checkoutHelper,
42+
$escaper
4043
);
4144
$this->_scopeConfig = $scopeConfig;
4245
}

app/code/Magento/Review/Controller/Product.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ protected function loadProduct($productId)
219219

220220
try {
221221
$product = $this->productRepository->getById($productId);
222+
223+
if (!in_array($this->storeManager->getStore()->getWebsiteId(), $product->getWebsiteIds())) {
224+
throw new NoSuchEntityException();
225+
}
226+
222227
if (!$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()) {
223228
throw new NoSuchEntityException();
224229
}

app/code/Magento/Review/Test/Unit/Controller/Product/PostTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,13 @@ protected function setUp()
170170
$ratingFactory->expects($this->once())->method('create')->willReturn($this->rating);
171171
$this->messageManager = $this->getMock('\Magento\Framework\Message\ManagerInterface');
172172

173-
$this->store = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false);
173+
$this->store = $this->getMock(
174+
'\Magento\Store\Model\Store',
175+
['getId', 'getWebsiteId'],
176+
[],
177+
'',
178+
false
179+
);
174180
$storeManager = $this->getMockForAbstractClass('\Magento\Store\Model\StoreManagerInterface');
175181
$storeManager->expects($this->any())->method('getStore')->willReturn($this->store);
176182

@@ -242,7 +248,7 @@ public function testExecute()
242248
->willReturn(1);
243249
$product = $this->getMock(
244250
'Magento\Catalog\Model\Product',
245-
['__wakeup', 'isVisibleInCatalog', 'isVisibleInSiteVisibility', 'getId'],
251+
['__wakeup', 'isVisibleInCatalog', 'isVisibleInSiteVisibility', 'getId', 'getWebsiteIds'],
246252
[],
247253
'',
248254
false
@@ -253,6 +259,10 @@ public function testExecute()
253259
$product->expects($this->once())
254260
->method('isVisibleInSiteVisibility')
255261
->willReturn(true);
262+
$product->expects($this->once())
263+
->method('getWebsiteIds')
264+
->willReturn([1]);
265+
256266
$this->productRepository->expects($this->any())->method('getById')
257267
->with(1)
258268
->willReturn($product);
@@ -288,6 +298,8 @@ public function testExecute()
288298
$this->review->expects($this->once())->method('setCustomerId')->with($customerId)->willReturnSelf();
289299
$this->store->expects($this->exactly(2))->method('getId')
290300
->willReturn($storeId);
301+
$this->store->expects($this->once())->method('getWebsiteId')
302+
->willReturn(1);
291303
$this->review->expects($this->once())->method('setStoreId')
292304
->with($storeId)
293305
->willReturnSelf();

app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ protected function _drawItem(\Magento\Framework\DataObject $item, \Zend_Pdf_Page
851851
protected function _setFontRegular($object, $size = 7)
852852
{
853853
$font = \Zend_Pdf_Font::fontWithPath(
854-
$this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Re-4.4.1.ttf')
854+
$this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerif.ttf')
855855
);
856856
$object->setFont($font, $size);
857857
return $font;
@@ -867,7 +867,7 @@ protected function _setFontRegular($object, $size = 7)
867867
protected function _setFontBold($object, $size = 7)
868868
{
869869
$font = \Zend_Pdf_Font::fontWithPath(
870-
$this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf')
870+
$this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerifBold.ttf')
871871
);
872872
$object->setFont($font, $size);
873873
return $font;
@@ -883,7 +883,7 @@ protected function _setFontBold($object, $size = 7)
883883
protected function _setFontItalic($object, $size = 7)
884884
{
885885
$font = \Zend_Pdf_Font::fontWithPath(
886-
$this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_It-2.8.2.ttf')
886+
$this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerifItalic.ttf')
887887
);
888888
$object->setFont($font, $size);
889889
return $font;

app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public function getItemOptions()
335335
protected function _setFontRegular($size = 7)
336336
{
337337
$font = \Zend_Pdf_Font::fontWithPath(
338-
$this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Re-4.4.1.ttf')
338+
$this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerif.ttf')
339339
);
340340
$this->getPage()->setFont($font, $size);
341341
return $font;
@@ -350,7 +350,7 @@ protected function _setFontRegular($size = 7)
350350
protected function _setFontBold($size = 7)
351351
{
352352
$font = \Zend_Pdf_Font::fontWithPath(
353-
$this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf')
353+
$this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerifBold.ttf')
354354
);
355355
$this->getPage()->setFont($font, $size);
356356
return $font;
@@ -365,7 +365,7 @@ protected function _setFontBold($size = 7)
365365
protected function _setFontItalic($size = 7)
366366
{
367367
$font = \Zend_Pdf_Font::fontWithPath(
368-
$this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_It-2.8.2.ttf')
368+
$this->_rootDirectory->getAbsolutePath('lib/internal/GnuFreeFont/FreeSerifItalic.ttf')
369369
);
370370
$this->getPage()->setFont($font, $size);
371371
return $font;

app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_minicart.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@
238238
.product-item-pricing {
239239
.label {
240240
display: inline-block;
241-
width: 4.5rem;
242241
}
243242
}
244243

app/design/frontend/Magento/blank/web/css/source/_extends.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@
12321232
}
12331233
}
12341234

1235-
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = (@screen__m + 1)) {
1235+
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
12361236
.abs-checkout-tooltip-content-position-top-mobile {
12371237
@abs-checkout-tooltip-content-position-top();
12381238
}

app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@
243243
.product-item-pricing {
244244
.label {
245245
display: inline-block;
246-
width: 4.5rem;
247246
}
248247
}
249248

app/design/frontend/Magento/luma/web/css/source/_extends.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@
16731673
}
16741674
}
16751675

1676-
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = (@screen__m + 1)) {
1676+
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
16771677
.abs-checkout-tooltip-content-position-top-mobile {
16781678
@abs-checkout-tooltip-content-position-top();
16791679
}
3.15 MB
Binary file not shown.
1.25 MB
Binary file not shown.
900 KB
Binary file not shown.

lib/internal/Magento/Framework/Console/Cli.php

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Framework\Shell\ComplexParameter;
1818
use Magento\Setup\Console\CompilerPreparation;
1919
use \Magento\Framework\App\ProductMetadata;
20+
use Magento\Framework\App\State;
2021

2122
/**
2223
* Magento 2 CLI Application. This is the hood for all command line tools supported by Magento
@@ -47,6 +48,11 @@ class Cli extends SymfonyApplication
4748
*/
4849
private $initException;
4950

51+
/**
52+
* @var \Magento\Framework\ObjectManagerInterface
53+
*/
54+
private $objectManager;
55+
5056
/**
5157
* @param string $name application name
5258
* @param string $version application version
@@ -56,15 +62,7 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
5662
{
5763
$this->serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')
5864
->getServiceManager();
59-
$generationDirectoryAccess = new GenerationDirectoryAccess($this->serviceManager);
60-
if (!$generationDirectoryAccess->check()) {
61-
$output = new ConsoleOutput();
62-
$output->writeln(
63-
'<error>Command line user does not have read and write permissions on var/generation directory. Please'
64-
. ' address this issue before using Magento command line.</error>'
65-
);
66-
exit(0);
67-
}
65+
6866
/**
6967
* Temporary workaround until the compiler is able to clear the generation directory
7068
* @todo remove after MAGETWO-44493 resolved
@@ -74,6 +72,21 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
7472
$compilerPreparation->handleCompilerEnvironment();
7573
}
7674

75+
$bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
76+
$params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
77+
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
78+
$bootstrap = Bootstrap::create(BP, $params);
79+
$this->objectManager = $bootstrap->getObjectManager();
80+
81+
if ($this->checkGenerationDirectoryAccess()) {
82+
$output = new ConsoleOutput();
83+
$output->writeln(
84+
'<error>Command line user does not have read and write permissions on var/generation directory. Please'
85+
. ' address this issue before using Magento command line.</error>'
86+
);
87+
exit(0);
88+
}
89+
7790
if ($version == 'UNKNOWN') {
7891
$directoryList = new DirectoryList(BP);
7992
$composerJsonFinder = new ComposerJsonFinder($directoryList);
@@ -83,6 +96,22 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
8396
parent::__construct($name, $version);
8497
}
8598

99+
/**
100+
* Check generation directory access.
101+
*
102+
* Skip and return true if production mode is enabled.
103+
*
104+
* @return bool
105+
*/
106+
private function checkGenerationDirectoryAccess()
107+
{
108+
$generationDirectoryAccess = new GenerationDirectoryAccess($this->serviceManager);
109+
/** @var State $state */
110+
$state = $this->objectManager->create(State::class);
111+
112+
return $state->getMode() !== State::MODE_PRODUCTION && !$generationDirectoryAccess->check();
113+
}
114+
86115
/**
87116
* Process an error happened during initialization of commands, if any
88117
*
@@ -121,31 +150,25 @@ protected function getApplicationCommands()
121150
{
122151
$commands = [];
123152
try {
124-
$bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
125-
$params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
126-
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
127-
$bootstrap = Bootstrap::create(BP, $params);
128-
$objectManager = $bootstrap->getObjectManager();
129-
130153
// Specialized setup command list available before and after M2 install
131154
if (class_exists('Magento\Setup\Console\CommandList')
132155
&& class_exists('Magento\Setup\Model\ObjectManagerProvider')
133156
) {
134157
/** @var \Magento\Setup\Model\ObjectManagerProvider $omProvider */
135158
$omProvider = $this->serviceManager->get(\Magento\Setup\Model\ObjectManagerProvider::class);
136-
$omProvider->setObjectManager($objectManager);
159+
$omProvider->setObjectManager($this->objectManager);
137160
$setupCommandList = new \Magento\Setup\Console\CommandList($this->serviceManager);
138161
$commands = array_merge($commands, $setupCommandList->getCommands());
139162
}
140163

141164
// Allowing instances of all modular commands only after M2 install
142-
if ($objectManager->get(\Magento\Framework\App\DeploymentConfig::class)->isAvailable()) {
165+
if ($this->objectManager->get(\Magento\Framework\App\DeploymentConfig::class)->isAvailable()) {
143166
/** @var \Magento\Framework\Console\CommandListInterface $commandList */
144-
$commandList = $objectManager->create(\Magento\Framework\Console\CommandListInterface::class);
167+
$commandList = $this->objectManager->create(\Magento\Framework\Console\CommandListInterface::class);
145168
$commands = array_merge($commands, $commandList->getCommands());
146169
}
147170

148-
$commands = array_merge($commands, $this->getVendorCommands($objectManager));
171+
$commands = array_merge($commands, $this->getVendorCommands($this->objectManager));
149172
} catch (\Exception $e) {
150173
$this->initException = $e;
151174
}

0 commit comments

Comments
 (0)