-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Incorrect configuration scope is occasionally returned when attempting to resolve a null scope id #16939
Comments
Hi @matthew-muscat. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
where @matthew-muscat do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hello @matthew-muscat, thank you for your report and pull request. |
@magento-engcom-team give me 2.2.5 instance |
Hi @matthew-muscat. Thank you for your request. I'm working on Magento 2.2.5 instance for you |
Hi @matthew-muscat, here is your Magento instance. |
@engcom-backlog-nickolas - this one's a little difficult to repeat in the test instance, as it requires a multistore setup and either environment emulation or store scope switching. My process to verify and repeat the issue has been to use environment emulation, then using the |
@matthew-muscat thank you for help. I've reproduced this issue locally. Thanks again for pull request. |
Hi @matthew-muscat. Thank you for your report.
The fix will be available with the upcoming 2.2.8 release. |
Hello, This fix should have been present since 2.2.8 but I can't see it in 2.3.0. |
Hi @matthew-muscat. Thank you for your report.
The fix will be available with the upcoming 2.3.2 release. |
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::resolve
method 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
$scopeCode
value that is used in theresolvedScopeCodes
array 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
$scopeCode
value can be avoided, as it does not appear to influence the resultThe text was updated successfully, but these errors were encountered: