From f54cb7fa29311fa650cbd05c01d93c781c66751e Mon Sep 17 00:00:00 2001 From: David Hiendl Date: Tue, 20 Jun 2023 11:34:31 +0200 Subject: [PATCH 1/4] fix eav_config_entity throwing error message on removed entity model --- app/code/core/Mage/Eav/Model/Config.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/code/core/Mage/Eav/Model/Config.php b/app/code/core/Mage/Eav/Model/Config.php index 363cfd090d4..83ee970f30b 100644 --- a/app/code/core/Mage/Eav/Model/Config.php +++ b/app/code/core/Mage/Eav/Model/Config.php @@ -186,8 +186,24 @@ protected function _loadEntityTypes() $this->_entityTypes = []; $this->_entityTypeByCode = []; $entityTypeCollection = Mage::getResourceModel('eav/entity_type_collection'); + /** @var Mage_Eav_Model_Entity_Type $entityType */ foreach ($entityTypeCollection as $entityType) { + + // Ensure eav entity type model class is defined, otherwise skip processing it. + // This check prevents leftover eav_entity_type entries from disabled/removed modules creating errors and + // is necessary because the entire EAV model is now loaded eagerly for performance optimization. + $entityModelClass = $entityType['entity_model']; + $fqEntityModelClass = Mage::getConfig()->getModelClassName($entityModelClass); + if (!class_exists($fqEntityModelClass)) { + if (Mage::getIsDeveloperMode()) { + throw new Exception('failed loading of eav entity type because it does not exist: ' . $entityModelClass); + } else { + Mage::log('skipped loading of eav entity type because it does not exist: ' . $entityModelClass); + } + continue; + } + $this->_entityTypes[$entityType->getId()] = $entityType; $this->_entityTypeByCode[$entityType->getEntityTypeCode()] = $entityType; } From b53ffcade9c7d5db08871bf9ae5180dd5ece5235 Mon Sep 17 00:00:00 2001 From: David Hiendl Date: Tue, 20 Jun 2023 11:45:03 +0200 Subject: [PATCH 2/4] fix phpcs --- app/code/core/Mage/Eav/Model/Config.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/core/Mage/Eav/Model/Config.php b/app/code/core/Mage/Eav/Model/Config.php index 83ee970f30b..cb3ca682e01 100644 --- a/app/code/core/Mage/Eav/Model/Config.php +++ b/app/code/core/Mage/Eav/Model/Config.php @@ -189,7 +189,6 @@ protected function _loadEntityTypes() /** @var Mage_Eav_Model_Entity_Type $entityType */ foreach ($entityTypeCollection as $entityType) { - // Ensure eav entity type model class is defined, otherwise skip processing it. // This check prevents leftover eav_entity_type entries from disabled/removed modules creating errors and // is necessary because the entire EAV model is now loaded eagerly for performance optimization. From 27cea009ae164795f3f98173ad92097e1d348ee4 Mon Sep 17 00:00:00 2001 From: David Hiendl Date: Tue, 20 Jun 2023 16:40:44 +0200 Subject: [PATCH 3/4] fix exception message capitalization --- app/code/core/Mage/Eav/Model/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Eav/Model/Config.php b/app/code/core/Mage/Eav/Model/Config.php index cb3ca682e01..8ab3fe91f25 100644 --- a/app/code/core/Mage/Eav/Model/Config.php +++ b/app/code/core/Mage/Eav/Model/Config.php @@ -196,7 +196,7 @@ protected function _loadEntityTypes() $fqEntityModelClass = Mage::getConfig()->getModelClassName($entityModelClass); if (!class_exists($fqEntityModelClass)) { if (Mage::getIsDeveloperMode()) { - throw new Exception('failed loading of eav entity type because it does not exist: ' . $entityModelClass); + throw new Exception('Failed loading of eav entity type because it does not exist: ' . $entityModelClass); } else { Mage::log('skipped loading of eav entity type because it does not exist: ' . $entityModelClass); } From 707167895fa4aaa5ba5224ac63ffde04cb419dc7 Mon Sep 17 00:00:00 2001 From: David Hiendl Date: Tue, 20 Jun 2023 17:01:05 +0200 Subject: [PATCH 4/4] fix log message capitalization --- app/code/core/Mage/Eav/Model/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Eav/Model/Config.php b/app/code/core/Mage/Eav/Model/Config.php index 8ab3fe91f25..619c411aef6 100644 --- a/app/code/core/Mage/Eav/Model/Config.php +++ b/app/code/core/Mage/Eav/Model/Config.php @@ -198,7 +198,7 @@ protected function _loadEntityTypes() if (Mage::getIsDeveloperMode()) { throw new Exception('Failed loading of eav entity type because it does not exist: ' . $entityModelClass); } else { - Mage::log('skipped loading of eav entity type because it does not exist: ' . $entityModelClass); + Mage::log('Skipped loading of eav entity type because it does not exist: ' . $entityModelClass); } continue; }