-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Incorrect configuration scope is occasionally returned when attempting to resolve a null scope id #16939
Copy link
Copy link
Closed
Labels
Component: Framework/AppFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releasehelp wanted
Metadata
Metadata
Assignees
Labels
Component: Framework/AppFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releasehelp wanted
Preconditions
Steps to reproduce
\Magento\Framework\App\Config\ScopeConfigInterface::getValue($configPath, 'stores')Expected result
-- The correct configuration value is retrieved based on the current store scope
-- The correct configuration value is retrieved based on the currently emulated store environment
Actual result
Root cause
ScopeCodeResolver::resolvemethod is not suitably handling a null scopeId value https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php#L40, this is due to a class property cache key of "$scopeCode" being nullresolvedScopeCodes[$scopeType][$scopeCode]is being used, which may return an incorrect scope - typically this is the default scopeProposed fix
$scopeCodevalue that is used in theresolvedScopeCodesarray should be replaced with the$resolvedScopeCode, ensuring the array is populated correctly and avoids returning an incorrect value when null is passed as the desired$scopeId$scopeCodevalue can be avoided, as it does not appear to influence the result