{"data":{"id":"magento2-36368","source":"github-pr","sourceRef":"magento/magento2#36368","title":"Do not load backend block context on frontend","pr":{"number":36368,"url":"https://github.com/magento/magento2/pull/36368","author":"ihor-sviziev","mergedAt":"2024-05-16T19:44:54Z","mergeCommit":"461a4c0695ad4b24d24c89c1cf67d2c05ddd3b35","headCommit":"e0b182613cb8b8a891f4b815ecdcfe0156fbfbaa","baseRef":"2.4-develop","diffSha256":"3029c0e6ba2ada4f6efeadb0f31d882ac42a5d2f46283c1c4a183fdcae43fd28"},"issues":[{"number":37617,"url":"https://github.com/magento/magento2/issues/37617","title":"[Issue] Do not load backend block context on frontend","labels":["Area: UI Framework","Component: Frontend","Issue: Confirmed","Priority: P2","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x"],"kind":"pr-derived"}],"fixedIn":"2.4.8","containingTags":["2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"reportedOn":null,"codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"conflict","2.4.8-p1":"conflict","2.4.8-p2":"conflict","2.4.8-p3":"conflict","2.4.8-p4":"conflict","2.4.8-p5":"conflict","2.4.9":"conflict"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10"],"components":["magento/module-gift-message"],"files":[{"path":"app/code/Magento/GiftMessage/Block/Cart/GiftOptions.php","change":"modified","package":"magento/module-gift-message"},{"path":"app/code/Magento/GiftMessage/Block/Cart/Item/Renderer/Actions/GiftOptions.php","change":"modified","package":"magento/module-gift-message"}],"stripped":{"tests":[],"docs":[],"outsideCode":[]},"linesChanged":7,"mergeBatched":false,"excluded":null,"sections":{"description":"The class is used on frontend, but loads the backend context. So with all dependencies, it's also creating backend session that additionally causes session locks.","stepsToReproduce":"1. Set a breakpoint in the constructor of `Magento\\Backend\\Block\\Template\\Context` (because it uses backend session `\\Magento\\Backend\\Model\\Session` and other heavy objects)\n2. Try placing an order on the frontend.\n\n**Expected result:** \n✅ the class from the \"backend\" module shoudln't be loaded on frontend\n**Actual result:**\n❌ the class is getting loaded on frontend.","expectedResult":null,"actualResult":null,"source":"pr"},"signatures":[],"labels":{"area":["UI Framework"],"component":["Frontend"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":[],"triage":{"model":"@cf/cloudflare/clef","requestHash":"5e90616bb9eb71b3dc332c78baff428e243087bea0ca1abb24696ed7c9f4234e","isBugfix":0.8084,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.8381,"feature":0.0078,"refactor":0.138,"tests_only":0.0051,"docs_only":0.0037,"dependency":0.0073},"confidence":0.666},"scope":{"score":0.3265,"probabilities":{"0":0.7255,"1":0.2226,"2":0.0519},"confidence":0.3678},"risk":{"score":0.43,"probabilities":{"0":0.7028,"1":0.1644,"2":0.1328},"confidence":0.3078},"area":{"choice":"checkout","probabilities":{"catalog":0.0117,"checkout":0.4872,"customer":0.0111,"admin":0.0276,"graphql_api":0.0043,"framework":0.1018,"frontend":0.2913,"other":0.065},"confidence":0.2432},"securityRelevant":0.2612,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0054,"2.4.0-p1":0.0044,"2.4.1":0.0043,"2.4.1-p1":0.0041,"2.4.2":0.0061,"2.4.2-p1":0.005,"2.4.2-p2":0.007,"2.4.3":0.0094,"2.4.3-p1":0.0092,"2.4.3-p2":0.0098,"2.4.3-p3":0.0071,"2.4.4":0.0156,"2.4.4-p1":0.0082,"2.4.4-p10":0.0071,"2.4.4-p11":0.007,"2.4.4-p12":0.0067,"2.4.4-p13":0.0065,"2.4.4-p14":0.008,"2.4.4-p15":0.0061,"2.4.4-p16":0.0068,"2.4.4-p17":0.0061,"2.4.4-p18":0.0052,"2.4.4-p2":0.0027,"2.4.4-p3":0.0031,"2.4.4-p4":0.003,"2.4.4-p5":0.0038,"2.4.4-p6":0.0044,"2.4.4-p7":0.0038,"2.4.4-p8":0.0047,"2.4.4-p9":0.004,"2.4.5":0.0156,"2.4.5-p1":0.0107,"2.4.5-p10":0.0078,"2.4.5-p11":0.0126,"2.4.5-p12":0.0102,"2.4.5-p13":0.0078,"2.4.5-p14":0.0074,"2.4.5-p15":0.0072,"2.4.5-p16":0.007,"2.4.5-p17":0.0068,"2.4.5-p2":0.0032,"2.4.5-p3":0.0054,"2.4.5-p4":0.0055,"2.4.5-p5":0.0038,"2.4.5-p6":0.0049,"2.4.5-p7":0.0053,"2.4.5-p8":0.0046,"2.4.5-p9":0.0043,"2.4.6":0.0307,"2.4.6-p1":0.0193,"2.4.6-p10":0.0093,"2.4.6-p11":0.0133,"2.4.6-p12":0.012,"2.4.6-p13":0.0131,"2.4.6-p14":0.0115,"2.4.6-p15":0.0088,"2.4.6-p2":0.0052,"2.4.6-p3":0.0084,"2.4.6-p4":0.0087,"2.4.6-p5":0.0074,"2.4.6-p6":0.0122,"2.4.6-p7":0.0089,"2.4.6-p8":0.0062,"2.4.6-p9":0.0058,"2.4.7":0.0189,"2.4.7-p1":0.0139,"2.4.7-p10":0.0098,"2.4.7-p2":0.0086,"2.4.7-p3":0.0141,"2.4.7-p4":0.0143,"2.4.7-p5":0.0131,"2.4.7-p6":0.0143,"2.4.7-p7":0.0121,"2.4.7-p8":0.0089,"2.4.7-p9":0.0059,"2.4.8":0.0272,"2.4.8-p1":0.0179,"2.4.8-p2":0.0191,"2.4.8-p3":0.0184,"2.4.8-p4":0.0153,"2.4.8-p5":0.0148,"2.4.9":0.0197,"unspecified":0.2382},"confidence":0.0548},"backportWorthy":{"score":1.515,"probabilities":{"0":0.1025,"1":0.28,"2":0.6175},"confidence":0.2053}},"curated":{"title":"Fixes cart gift options blocks loading the backend block context on the frontend","description":"The GiftMessage Cart GiftOptions block and the Cart Item Renderer Actions GiftOptions block are used on frontend, but load the backend context, which is also creating backend session that causes session locks. Both now use the Framework View Element Template Context, and the Cart GiftOptions class extends the Framework Template, not the Backend Template.","categories":[],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":null},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-36368 details"}