Skip to content

Commit 4083d7c

Browse files
authored
ENGCOM-5696: Resolve undefined variable in cleanFileExtensions() function #24283
2 parents 26a2b86 + 6320250 commit 4083d7c

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

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

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ protected function _getResource()
167167
}
168168

169169
/**
170+
* Construct function
171+
*
170172
* @return void
171173
*/
172174
protected function _construct()
@@ -215,6 +217,8 @@ public function hasValues($type = null)
215217
}
216218

217219
/**
220+
* Get values
221+
*
218222
* @return ProductCustomOptionValuesInterface[]|null
219223
*/
220224
public function getValues()
@@ -345,7 +349,8 @@ public function groupFactory($type)
345349
}
346350

347351
/**
348-
* {@inheritdoc}
352+
* @inheritdoc
353+
*
349354
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
350355
* @since 101.0.0
351356
*/
@@ -396,6 +401,8 @@ public function beforeSave()
396401
}
397402

398403
/**
404+
* After save
405+
*
399406
* @return \Magento\Framework\Model\AbstractModel
400407
* @throws \Magento\Framework\Exception\LocalizedException
401408
*/
@@ -424,7 +431,8 @@ public function afterSave()
424431

425432
/**
426433
* Return price. If $flag is true and price is percent
427-
* return converted percent to price
434+
*
435+
* Return converted percent to price
428436
*
429437
* @param bool $flag
430438
* @return float
@@ -555,7 +563,7 @@ protected function _clearReferences()
555563
}
556564

557565
/**
558-
* {@inheritdoc}
566+
* @inheritdoc
559567
*/
560568
protected function _getValidationRulesBeforeSave()
561569
{
@@ -649,6 +657,8 @@ public function getSku()
649657
}
650658

651659
/**
660+
* Get file extension
661+
*
652662
* @return string|null
653663
*/
654664
public function getFileExtension()
@@ -657,6 +667,8 @@ public function getFileExtension()
657667
}
658668

659669
/**
670+
* Get Max Characters
671+
*
660672
* @return int|null
661673
*/
662674
public function getMaxCharacters()
@@ -665,6 +677,8 @@ public function getMaxCharacters()
665677
}
666678

667679
/**
680+
* Get image size X
681+
*
668682
* @return int|null
669683
*/
670684
public function getImageSizeX()
@@ -673,6 +687,8 @@ public function getImageSizeX()
673687
}
674688

675689
/**
690+
* Get image size Y
691+
*
676692
* @return int|null
677693
*/
678694
public function getImageSizeY()
@@ -780,6 +796,8 @@ public function setSku($sku)
780796
}
781797

782798
/**
799+
* Set File Extension
800+
*
783801
* @param string $fileExtension
784802
* @return $this
785803
*/
@@ -789,6 +807,8 @@ public function setFileExtension($fileExtension)
789807
}
790808

791809
/**
810+
* Set Max Characters
811+
*
792812
* @param int $maxCharacters
793813
* @return $this
794814
*/
@@ -798,6 +818,8 @@ public function setMaxCharacters($maxCharacters)
798818
}
799819

800820
/**
821+
* Set Image Size X
822+
*
801823
* @param int $imageSizeX
802824
* @return $this
803825
*/
@@ -807,6 +829,8 @@ public function setImageSizeX($imageSizeX)
807829
}
808830

809831
/**
832+
* Set Image Size Y
833+
*
810834
* @param int $imageSizeY
811835
* @return $this
812836
*/
@@ -816,6 +840,8 @@ public function setImageSizeY($imageSizeY)
816840
}
817841

818842
/**
843+
* Set value
844+
*
819845
* @param ProductCustomOptionValuesInterface[] $values
820846
* @return $this
821847
*/
@@ -826,7 +852,7 @@ public function setValues(array $values = null)
826852
}
827853

828854
/**
829-
* {@inheritdoc}
855+
* @inheritdoc
830856
*
831857
* @return \Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface|null
832858
*/
@@ -852,6 +878,8 @@ public function getRegularPrice()
852878
}
853879

854880
/**
881+
* Get Product Option Collection
882+
*
855883
* @param Product $product
856884
* @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
857885
*/
@@ -882,7 +910,7 @@ public function getProductOptionCollection(Product $product)
882910
}
883911

884912
/**
885-
* {@inheritdoc}
913+
* @inheritdoc
886914
*
887915
* @param \Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface $extensionAttributes
888916
* @return $this
@@ -894,6 +922,8 @@ public function setExtensionAttributes(
894922
}
895923

896924
/**
925+
* Get option repository
926+
*
897927
* @return Option\Repository
898928
*/
899929
private function getOptionRepository()
@@ -906,6 +936,8 @@ private function getOptionRepository()
906936
}
907937

908938
/**
939+
* Get metadata pool
940+
*
909941
* @return \Magento\Framework\EntityManager\MetadataPool
910942
*/
911943
private function getMetadataPool()
@@ -931,7 +963,7 @@ private function cleanFileExtensions()
931963
preg_match_all('/(?<extensions>[a-z0-9]+)/i', strtolower($rawExtensions), $matches);
932964
if (!empty($matches)) {
933965
$extensions = implode(', ', array_unique($matches['extensions']));
966+
$this->setFileExtension($extensions);
934967
}
935-
$this->setFileExtension($extensions);
936968
}
937969
}

0 commit comments

Comments
 (0)