{"data":{"id":"magento2-38433","source":"github-pr","sourceRef":"magento/magento2#38433","title":"ProductRepository function GetById does not create the correct cache key","pr":{"number":38433,"url":"https://github.com/magento/magento2/pull/38433","author":"MaximGns","mergedAt":"2024-05-28T15:06:25Z","mergeCommit":"89e49b8a8e96ba6bac1f1c46b6cd33c38e289a3d","headCommit":"2aa6cfc10a2de15ce9b2d0eb923bd5ee76296bcc","baseRef":"2.4-develop","diffSha256":"82f02c06b1c1a6a0bbc601a20d28a14e7e6ee40283e2aa7d7c132fdaad778f14"},"issues":[{"number":38384,"url":"https://github.com/magento/magento2/issues/38384","title":"ProductRepository function GetById does not create the correct cache key","labels":["Area: Product","Component: Cache","Issue: Confirmed","Priority: P2","Progress: done","Reported on 2.4.6-p3","Reproduced on 2.4.x","Triage: Dev.Experience"],"kind":"human"}],"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":"2.4.6-p3","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-catalog"],"files":[{"path":"app/code/Magento/Catalog/Model/ProductRepository.php","change":"modified","package":"magento/module-catalog"}],"stripped":{"tests":["app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php"],"docs":[],"outsideCode":[]},"linesChanged":2,"mergeBatched":false,"excluded":null,"sections":{"description":"Product is retrieved twice","stepsToReproduce":"Use the product repository in a class\n\nRetrieve the product by using the repositories method 'getById' with same parameters except the $storeId should be once string and the other time it should be and integer\n\n```\n$product = $this->productRepository->getById(1, false, '1');\n$product = $this->productRepository->getById(1, false, 1);\n```\n\nProduct is retrieved twice from database","expectedResult":"When using the `getById` method with same store value (string or int). The second time the product should be retrieved from memory.","actualResult":"Product is retrieved twice","source":"issue"},"signatures":[],"labels":{"area":["Product"],"component":["Cache"],"priority":"P2","severity":null,"reportedOn":["2.4.6-p3"]},"categories":["Cache","Catalog/Product"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"fc59a205dff1072cc83045af93f9adab7d332fee476eda8f858d381032a1e564","isBugfix":0.9787,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9521,"feature":0.0065,"refactor":0.0157,"tests_only":0.015,"docs_only":0.0053,"dependency":0.0054},"confidence":0.8884},"scope":{"score":0.8558,"probabilities":{"0":0.2307,"1":0.6828,"2":0.0865},"confidence":0.2904},"risk":{"score":0.2046,"probabilities":{"0":0.8305,"1":0.1344,"2":0.0351},"confidence":0.5636},"area":{"choice":"catalog","probabilities":{"catalog":0.64,"checkout":0.0106,"customer":0.0075,"admin":0.0196,"graphql_api":0.0079,"framework":0.2915,"frontend":0.0122,"other":0.0107},"confidence":0.4234},"securityRelevant":0.0076,"reportedVersion":{"choice":"2.4.6-p3","probabilities":{"2.4.0":0.0023,"2.4.0-p1":0.0028,"2.4.1":0.0024,"2.4.1-p1":0.0027,"2.4.2":0.0023,"2.4.2-p1":0.0028,"2.4.2-p2":0.0029,"2.4.3":0.0026,"2.4.3-p1":0.0034,"2.4.3-p2":0.004,"2.4.3-p3":0.004,"2.4.4":0.0023,"2.4.4-p1":0.0029,"2.4.4-p10":0.0034,"2.4.4-p11":0.0035,"2.4.4-p12":0.0032,"2.4.4-p13":0.0035,"2.4.4-p14":0.0032,"2.4.4-p15":0.0032,"2.4.4-p16":0.0037,"2.4.4-p17":0.0032,"2.4.4-p18":0.0031,"2.4.4-p2":0.0029,"2.4.4-p3":0.0032,"2.4.4-p4":0.0024,"2.4.4-p5":0.0027,"2.4.4-p6":0.0033,"2.4.4-p7":0.0027,"2.4.4-p8":0.003,"2.4.4-p9":0.0027,"2.4.5":0.0028,"2.4.5-p1":0.0037,"2.4.5-p10":0.0034,"2.4.5-p11":0.0043,"2.4.5-p12":0.0045,"2.4.5-p13":0.0039,"2.4.5-p14":0.0034,"2.4.5-p15":0.0033,"2.4.5-p16":0.0037,"2.4.5-p17":0.003,"2.4.5-p2":0.0032,"2.4.5-p3":0.0042,"2.4.5-p4":0.0031,"2.4.5-p5":0.0031,"2.4.5-p6":0.0046,"2.4.5-p7":0.0035,"2.4.5-p8":0.0032,"2.4.5-p9":0.0026,"2.4.6":0.0297,"2.4.6-p1":0.0071,"2.4.6-p10":0.0031,"2.4.6-p11":0.0032,"2.4.6-p12":0.003,"2.4.6-p13":0.0058,"2.4.6-p14":0.0029,"2.4.6-p15":0.0029,"2.4.6-p2":0.0054,"2.4.6-p3":0.6789,"2.4.6-p4":0.0076,"2.4.6-p5":0.007,"2.4.6-p6":0.0073,"2.4.6-p7":0.0054,"2.4.6-p8":0.0049,"2.4.6-p9":0.0046,"2.4.7":0.0032,"2.4.7-p1":0.0036,"2.4.7-p10":0.0036,"2.4.7-p2":0.0031,"2.4.7-p3":0.0043,"2.4.7-p4":0.0036,"2.4.7-p5":0.0036,"2.4.7-p6":0.0046,"2.4.7-p7":0.0032,"2.4.7-p8":0.003,"2.4.7-p9":0.0027,"2.4.8":0.003,"2.4.8-p1":0.0036,"2.4.8-p2":0.0039,"2.4.8-p3":0.0042,"2.4.8-p4":0.0039,"2.4.8-p5":0.0039,"2.4.9":0.0034,"unspecified":0.003},"confidence":0.4563},"backportWorthy":{"score":1.3053,"probabilities":{"0":0.209,"1":0.2766,"2":0.5144},"confidence":0.0772}},"curated":{"title":"ProductRepository::getById loads a product twice for a string and int store ID","description":"ProductRepository getById does not create the correct cache key, because the store ID passed as string is not parsed to an integer, so the same product is retrieved twice from the database. The change has the store ID parsed to an integer in the cache key.","categories":["Cache","Catalog/Product"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.7-p10":{"before":"pass","after":"pass","adapted":false,"runAt":"2026-10-06T09:29:13.535Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"pass","after":"pass","runAt":"2026-10-06T09:29:13.535Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-38433 details"}