- Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Area: CatalogComponent: CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressProgress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Description
Bug
The following condition is obviously invalid:
$isActiveExpr = $connection->getCheckSql('c.value_id > 0', 'c.value', 'c.value'); |
Explanation
The resulting query is:
SELECT `main*table\`.`entity*id`, `main*table\`.`parent*id`, `main_table\`.`level`, IF(c.value*id > 0, c.value, c.value) AS `is*active`, `main_table\`.`path` FROM `catalog*category_entity\` AS `main*table` LEFT JOIN `catalog*category_entity_int\` AS `d` ON d.attribute_id = 46 AND d.store_id = 0 AND d.entity_id = main_table.entity*id LEFT JOIN `catalog*category_entity_int\` AS `c` ON c.attribute_id = 46 AND c.store_id = 3 AND c.entity_id = main_table.entity*id WHERE (main*table.entity*id IN(...))
Attribute is_active\
is joined twice on both the store (c\
) and default scope (d\
). If there is no value available on the store scope (c.value\
) the default scope (d.value
) should be used instead.
Solution
The condition from line 415:
$isActiveExpr = $connection->getCheckSql('c.value_id > 0', 'c.value', 'c.value');
Should be changed to:
$isActiveExpr = $connection->getCheckSql('c.value_id IS NOT NULL', 'c.value', 'd.value');
Note: This bug might not be affecting any Magento code (depends if the is_active
flag is actually being used somewhere).
andrewbess
Metadata
Metadata
Assignees
Labels
Area: CatalogComponent: CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressProgress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it