-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Exception #0 (ReflectionException): Class "***********************" does not exist. Wrong logic. #38480
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
Comments
Hi @Genaker. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
Hi @engcom-November. Thank you for working on this issue.
|
Hello @Genaker, Thank you for the report and collaboration! Verified this issue on 2.4-develop. Please take a look at the screenshot below: Instead, we should have received something like this. Hence Confirming the issue. Please find the custom module used to reproduce the issue. Thank you. |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-11469 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-November. Thank you for verifying the issue. |
@magento I'm working on this |
Preconditions and environment
Magento 2 Core all versions have a core issue. When the source model of the EAV class from the Database does not exist magento throws
ReflectionException
Exception #0 (ReflectionException): Class "**\Model\Config\Source***\Options" does not exist
however, it has logic to tell you exactly what attribute Model is missing
but this logic never happens because it is an Exception(ReflectionException) not a bool value
you need to add this code and check exception
public function getSource()
{
if (empty($this->_source)) {
if (!$this->getSourceModel()) {
$this->_source = $this->_getDefaultSourceModel();
} else {
$this->_source = $this->getSourceModel();
}
try {
$source = $this->_universalFactory->create($this->_source);
} catch (\ReflectionException $e) {
$source = false;
}
if (!$source) {
throw new LocalizedException(
__(
'Source model "%1" not found for attribute "%2"',
$this->getSourceModel(),
$this->getAttributeCode()
)
);
}
then an exception will be self-explained:
Exception #0 (Magento\Framework\Exception\LocalizedException): Source model "*****\Model\Config\Source*\Options" not found for attribute "some_attribute"
Please fix it ASAP.
Related issue: #30278
Steps to reproduce
Expected result
Normal Exception explanation
Exception #0 (Magento\Framework\Exception\LocalizedException): Source model "*****\Model\Config\Source*\Options" not found for attribute "some_attribute"
Actual result
Exception #0 (ReflectionException): Class "***********************" does not exist.
Additional information
No response
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: