Skip to content

Unable to Apply Custom Patch on Magento 2.4.5p2 Cloud

Below are the logs on the server

[2024-06-12T13:47:34.472113+00:00] INFO: Verbosity level is not set
[2024-06-12T13:47:34.478688+00:00] NOTICE: Applying patches
[2024-06-12T13:47:35.346915+00:00] ERROR: The command “php ./vendor/bin/ece-patches apply –no-interaction” failed. Applying hot-fixes
Patch ../m2-hotfixes/ACSD-50165_EE_2.4.4_v1.patch has been applied
Error: patch /app/m2-hotfixes/Reorder.patch can’t be applied
Start of rollback
Patch ../M2-HOTFIXES/ACSD-50165_EE_2.4.4_V1.PATCH has been reverted
End of rollback
Magento 2 Enterprise Edition, version 2.4.5.0-patch2
Applying patch /app/m2-hotfixes/Reorder.patch failed.
error: patch failed: vendor/magento/module-catalog/Model/Product/Option/Type/Select.php:101
error: vendor/magento/module-catalog/Model/Product/Option/Type/Select.php: patch does not apply
[2024-06-12T13:47:35.348688+00:00] ERROR: [12] The command “php ./vendor/bin/ece-patches apply –no-interaction” failed. Applying hot-fixes
Patch ../m2-hotfixes/ACSD-50165_EE_2.4.4_v1.patch has been applied
Error: patch /app/m2-hotfixes/Reorder.patch can’t be applied
Start of rollback
Patch ../M2-HOTFIXES/ACSD-50165_EE_2.4.4_V1.PATCH has been reverted
End of rollback
Magento 2 Enterprise Edition, version 2.4.5.0-patch2
Applying patch /app/m2-hotfixes/Reorder.patch failed.
error: patch failed: vendor/magento/module-catalog/Model/Product/Option/Type/Select.php:101
error: vendor/magento/module-catalog/Model/Product/Option/Type/Select.php: patch does not applyenter

Here is the code of the patch file

diff --git a/vendor/magento/module-catalog/Model/Product/Option/Type/Select.php b/vendor/magento/module-catalog/Model/Product/Option/Type/Select.php
index 3ee2rd..8349152 100644
--- a/vendor/magento/module-catalog/Model/Product/Option/Type/Select.php
+++ b/vendor/magento/module-catalog/Model/Product/Option/Type/Select.php
@@ -101,7 +101,7 @@
                 $value = explode(',', $value);
             }
             $valuesCollection = $option->getOptionValuesByOptionId($value, $this->getProduct()->getStoreId())->load();
-            $valueCount = is_array($value) ? count($value) : 0;
+            $valueCount = is_array($value) ? count($value) : 1;
             if ($valuesCollection->count() != $valueCount) {
                 $this->setIsValid(false);
                 throw new LocalizedException(