Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAV Config Cache followup: select non-existent attribute exception #3038

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ public function addAttributeToSelect($attribute, $joinType = false)
} else {
$attrInstance = Mage::getSingleton('eav/config')
->getAttribute($this->getEntity()->getType(), $attribute);
// failure to resolve an attribute from the eav config implies it does not exist
if (empty($attrInstance)) {
return $this;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt we log situations like this? Typo in the attribute name is a bug, a deweloper would like to know about

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessarily a bug, it could just be a deleted attribute that was referenced somewhere. But perhaps throw an exception in developer mode and log it in production mode. Let me know what you prefer and I defer to you and make the change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, nothing, or only a log when dev mode is enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't care, if an attribute disappears there will be an errors in some template or some other code without the need to do anything here, although maybe it would be a bit cleaner

}
}
if (empty($attrInstance)) {
throw Mage::exception(
Expand Down