Skip to content

Commit 5fa52a8

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into MAGETWO-83706
2 parents 8af9827 + 5ed3aa3 commit 5fa52a8

File tree

25 files changed

+62
-62
lines changed

25 files changed

+62
-62
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ language: php
1515
php:
1616
- 7.0
1717
- 7.1
18+
git:
19+
depth: 5
1820
env:
1921
global:
2022
- COMPOSER_BIN_DIR=~/bin

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Massaction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function render(\Magento\Framework\DataObject $row)
6565
*/
6666
protected function _getCheckboxHtml($value, $checked)
6767
{
68-
$id = 'id_' . rand(0, 999);
68+
$id = 'id_' . random_int(0, 999);
6969
$html = '<label class="data-grid-checkbox-cell-inner" for="'. $id .'">';
7070
$html .= '<input type="checkbox" name="' . $this->getColumn()->getName() . '" ';
7171
$html .= 'id="' . $id . '" data-role="select-row"';

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,25 @@ class AttributeFilter
2828
public function prepareProductAttributes(Product $product, array $productData, array $useDefaults)
2929
{
3030
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-
}
31+
if ($this->isAttributeShouldNotBeUpdated($product, $useDefaults, $attribute, $value)) {
32+
unset($productData[$attribute]);
3733
}
3834
}
35+
3936
return $productData;
4037
}
38+
39+
/**
40+
* @param Product $product
41+
* @param $useDefaults
42+
* @param $attribute
43+
* @param $value
44+
* @return bool
45+
*/
46+
private function isAttributeShouldNotBeUpdated(Product $product, $useDefaults, $attribute, $value)
47+
{
48+
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
49+
50+
return ($value === '' && $considerUseDefaultsAttribute && !$product->getData($attribute));
51+
}
4152
}

app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ protected function getTemporaryTreeIndexTableName()
594594
if (empty($this->tempTreeIndexTableName)) {
595595
$this->tempTreeIndexTableName = $this->connection->getTableName('temp_catalog_category_tree_index')
596596
. '_'
597-
. substr(md5(time() . rand(0, 999999999)), 0, 8);
597+
. substr(md5(time() . random_int(0, 999999999)), 0, 8);
598598
}
599599

600600
return $this->tempTreeIndexTableName;

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,11 @@
4747
"data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
4848
"options": {
4949
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>",
50-
<?php if (($block->getVar("gallery/loop"))): ?>
51-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ?>,
52-
<?php endif; ?>
53-
<?php if (($block->getVar("gallery/keyboard"))): ?>
54-
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ?>,
55-
<?php endif; ?>
56-
<?php if (($block->getVar("gallery/arrows"))): ?>
57-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ?>,
58-
<?php endif; ?>
59-
<?php if (($block->getVar("gallery/allowfullscreen"))): ?>
60-
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ?>,
61-
<?php endif; ?>
62-
<?php if (($block->getVar("gallery/caption"))): ?>
63-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ?>,
64-
<?php endif; ?>
50+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ? 'true' : 'false' ?>,
51+
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ? 'true' : 'false' ?>,
52+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ? 'true' : 'false' ?>,
53+
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ? 'true' : 'false' ?>,
54+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ? 'true' : 'false' ?>,
6555
"width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
6656
"thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
6757
<?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
@@ -79,28 +69,18 @@
7969
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
8070
<?php endif; ?>
8171
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
82-
<?php if (($block->getVar("gallery/navarrows"))): ?>
83-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ?>,
84-
<?php endif; ?>
72+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
8573
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
8674
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
8775
},
8876
"fullscreen": {
8977
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
90-
<?php if ($block->getVar("gallery/fullscreen/loop")): ?>
91-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ?>,
92-
<?php endif; ?>
78+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
9379
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
94-
<?php if ($block->getVar("gallery/transition/navarrows")): ?>
95-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ?>,
96-
<?php endif; ?>
80+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
9781
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
98-
<?php if ($block->getVar("gallery/fullscreen/arrows")): ?>
99-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ?>,
100-
<?php endif; ?>
101-
<?php if ($block->getVar("gallery/fullscreen/caption")): ?>
102-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ?>,
103-
<?php endif; ?>
82+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
83+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
10484
<?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
10585
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
10686
<?php endif; ?>

app/code/Magento/CatalogSearch/Block/Advanced/Form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,16 @@ public function getCurrency($attribute)
201201
public function getAttributeInputType($attribute)
202202
{
203203
$dataType = $attribute->getBackend()->getType();
204-
$imputType = $attribute->getFrontend()->getInputType();
205-
if ($imputType == 'select' || $imputType == 'multiselect') {
204+
$inputType = $attribute->getFrontend()->getInputType();
205+
if ($inputType == 'select' || $inputType == 'multiselect') {
206206
return 'select';
207207
}
208208

209-
if ($imputType == 'boolean') {
209+
if ($inputType == 'boolean') {
210210
return 'yesno';
211211
}
212212

213-
if ($imputType == 'price') {
213+
if ($inputType == 'price') {
214214
return 'price';
215215
}
216216

app/code/Magento/Payment/Helper/Data.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ public function getPaymentMethodList($sorted = true, $asLabelValue = false, $wit
293293
foreach ($methods as $code => $title) {
294294
if (isset($groups[$code])) {
295295
$labelValues[$code]['label'] = $title;
296-
$labelValues[$code]['value'] = null;
296+
if (!isset($labelValues[$code]['value'])) {
297+
$labelValues[$code]['value'] = null;
298+
}
297299
} elseif (isset($groupRelations[$code])) {
298300
unset($labelValues[$code]);
299301
$labelValues[$groupRelations[$code]]['value'][$code] = ['value' => $code, 'label' => $title];

app/code/Magento/SalesRule/Model/Coupon/Codegenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function generateCode()
3838
$length = $this->getActualLength();
3939
$code = '';
4040
for ($i = 0, $indexMax = strlen($alphabet) - 1; $i < $length; ++$i) {
41-
$code .= substr($alphabet, mt_rand(0, $indexMax), 1);
41+
$code .= substr($alphabet, random_int(0, $indexMax), 1);
4242
}
4343

4444
return $code;
@@ -54,7 +54,7 @@ protected function getActualLength()
5454
$lengthMin = $this->getLengthMin() ? $this->getLengthMin() : static::DEFAULT_LENGTH_MIN;
5555
$lengthMax = $this->getLengthMax() ? $this->getLengthMax() : static::DEFAULT_LENGTH_MAX;
5656

57-
return $this->getLength() ? $this->getLength() : mt_rand($lengthMin, $lengthMax);
57+
return $this->getLength() ? $this->getLength() : random_int($lengthMin, $lengthMax);
5858
}
5959

6060
/**

app/code/Magento/SalesRule/Model/Rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ public function acquireCoupon($saveNewlyCreated = true, $saveAttemptCount = 10)
521521
$coupon->setCode(
522522
$couponCode . self::getCouponCodeGenerator()->getDelimiter() . sprintf(
523523
'%04u',
524-
rand(0, 9999)
524+
random_int(0, 9999)
525525
)
526526
);
527527
continue;

lib/internal/Magento/Framework/Encryption/Crypt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct(
7575
$abc = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
7676
$initVector = '';
7777
for ($i = 0; $i < $initVectorSize; $i++) {
78-
$initVector .= $abc[rand(0, strlen($abc) - 1)];
78+
$initVector .= $abc[random_int(0, strlen($abc) - 1)];
7979
}
8080
} elseif (false === $initVector) {
8181
/* Set vector to zero bytes to not use it */

0 commit comments

Comments
 (0)