From 62c7b6b2b8e8a078e975a62daaac067361a09e12 Mon Sep 17 00:00:00 2001 From: Ng Kiat Siong Date: Wed, 11 Sep 2024 14:31:39 +0800 Subject: [PATCH 1/2] Fixed phpstan on Mage_Customer_Model_Customer --- .phpstan.dist.baseline.neon | 5 ----- app/code/core/Mage/Customer/Model/Customer.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index 08f066bb2b0..18291848aca 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -2710,11 +2710,6 @@ parameters: count: 2 path: app/code/core/Mage/Customer/Model/Convert/Parser/Customer.php - - - message: "#^Method Mage_Directory_Model_Region\\:\\:loadByName\\(\\) invoked with 1 parameter, 2 required\\.$#" - count: 1 - path: app/code/core/Mage/Customer/Model/Customer.php - - message: "#^Parameter \\#1 \\$data \\(stdClass\\) of method Mage_Customer_Model_Customer_Api_V2\\:\\:_prepareData\\(\\) should be compatible with parameter \\$data \\(array\\) of method Mage_Customer_Model_Customer_Api\\:\\:_prepareData\\(\\)$#" count: 1 diff --git a/app/code/core/Mage/Customer/Model/Customer.php b/app/code/core/Mage/Customer/Model/Customer.php index 6d9dede2b12..9aef508f5f7 100644 --- a/app/code/core/Mage/Customer/Model/Customer.php +++ b/app/code/core/Mage/Customer/Model/Customer.php @@ -1416,7 +1416,7 @@ public function validateAddress(array $data, $type = 'billing') return false; } - $region = Mage::getModel('directory/region')->loadByName($data[$prefix . 'region']); + $region = Mage::getModel('directory/region')->loadByName($data[$prefix . 'region'], 'US'); if (!$region->getId()) { return false; } From 508b91766f036324e9faf67684eb7e4cf00fa0e7 Mon Sep 17 00:00:00 2001 From: Ng Kiat Siong Date: Tue, 17 Sep 2024 17:40:28 +0800 Subject: [PATCH 2/2] Update app/code/core/Mage/Customer/Model/Customer.php Co-authored-by: Sven Reichel --- app/code/core/Mage/Customer/Model/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Customer/Model/Customer.php b/app/code/core/Mage/Customer/Model/Customer.php index 9aef508f5f7..a81cbcb0e4f 100644 --- a/app/code/core/Mage/Customer/Model/Customer.php +++ b/app/code/core/Mage/Customer/Model/Customer.php @@ -1416,7 +1416,7 @@ public function validateAddress(array $data, $type = 'billing') return false; } - $region = Mage::getModel('directory/region')->loadByName($data[$prefix . 'region'], 'US'); + $region = Mage::getModel('directory/region')->loadByName($data[$prefix . 'region'], $data[$prefix . $field]); if (!$region->getId()) { return false; }