[Issue] Don't assume a frontend cache section exists in the env.php file. #38363
Closed
3 of 5 tasks
Labels
Area: Framework
Issue: Confirmed
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Priority: P2
A defect with this priority could have functionality issues which are not to expectations.
Progress: done
Reported on 2.4.x
Indicates original Magento version for the Issue report.
Reproduced on 2.4.x
The issue has been reproduced on latest 2.4-develop branch
Projects
This issue is automatically created based on existing pull request: #38119: Don't assume a frontend cache section exists in the env.php file.
Description (*)
Code exists in Magento that assumes your
app/etc/env.php
will always contain afrontend
section if there is acache
section. Like this:But that's not always the case. All shops that were setup before Magento 2.3.1 didn't have a
cache
section in theirenv.php
file in a default installation (if they didn't use Redis as caching).If they now upgrade to Magento 2.4.4 or higher and use a graphql endpoint, Magento automatically writes
cache > graphql > id_salt
to theenv.php
file and so introduces acache
section without afrontend
section.This then leads to this crash on every execution within Magento (frontend, backoffice,
bin/magento
, ...):This PR fixes this.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
app/etc/env.php
file and remove the entirefrontend
section in thecache
sectionbin/magento
or visit the frontendvendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php
)More elaborate testing scenario that can cause this situation:
app/etc/env.php
file contains nocache
sectionbin/magento setup:upgrade
app/etc/env.php
file will be updated to a new format, but will still not contain acache
section./graphql
urlapp/etc/env.php
file and see that acache
section has appeared with agraphql
section but nofrontend
sectionbin/magento
Questions or comments
Should we expect that when we run
bin/magento setup:upgrade
it will update yourapp/etc/env.php
file with all missing sections? Would people expect this? Or will this cause issues in some scenario's? Runningbin:magento setup:config:set
without extra flags does exactly that. That seems to be some kind of hidden feature ...Contribution checklist (*)
The text was updated successfully, but these errors were encountered: