{"data":{"id":"magento2-33161","source":"github-pr","sourceRef":"magento/magento2#33161","title":"Allow only valid preferences during setup:di:compile","pr":{"number":33161,"url":"https://github.com/magento/magento2/pull/33161","author":"fredden","mergedAt":"2024-11-12T12:33:22Z","mergeCommit":"8a4bbf9cb6bef5d0c7d966737acf00809bce63cc","headCommit":"59e9ddd03fec3e42804e3ad514d78a551f0c1ad2","baseRef":"2.4-develop","diffSha256":"04e58c950a0da72c02617d584563a62084c8c63e28f68c80563aa3a2ecf0d463"},"issues":[{"number":38517,"url":"https://github.com/magento/magento2/issues/38517","title":"[Issue] Allow only valid preferences during setup:di:compile","labels":["Area: Framework","Component: Setup","Issue: Confirmed","Priority: P3","Progress: done","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-catalog","magento/module-remote-storage"],"files":[{"path":"app/code/Magento/Catalog/etc/di.xml","change":"modified","package":"magento/module-catalog"},{"path":"app/code/Magento/RemoteStorage/etc/di.xml","change":"modified","package":"magento/module-remote-storage"}],"stripped":{"tests":["dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php","setup/src/Magento/Setup/Test/Unit/Module/Di/Compiler/Config/ReaderTest.php"],"docs":[],"outsideCode":["app/etc/di.xml","setup/src/Magento/Setup/Console/Command/DiCompileCommand.php","setup/src/Magento/Setup/Module/Di/Code/Reader/Decorator/Area.php","setup/src/Magento/Setup/Module/Di/Compiler/ArgumentsResolver.php","setup/src/Magento/Setup/Module/Di/Compiler/Config/Reader.php","setup/src/Magento/Setup/Module/Di/Definition/Collection.php"]},"linesChanged":10,"mergeBatched":false,"excluded":null,"sections":{"description":"The `setup:di:compile` command has exclude lists to avoid loading / compiling dependency injection for 'test' classes. When preferences exist for these excluded classes, any plugins associated with the original classes are (potentially) rendered useless. This is because the child class (preference) can call the original class in a way which does not use Magento's plugin system (ie, `parent::methodName()`). And it's impossible to plugin a class that does not go through Magento's compilation process (to have interceptors created, etc). See https://github.com/magento/security-package/issues/296 for a real-world example of this problem in action.","stepsToReproduce":"1. Create a preference for a class which does not exist. The \"for\" class can exist or not; the \"type\" class should not exist.\n1. Create a preference for a class which is specifically excluded (like a \"test\" class). The \"for\" class can exist or not; the \"type\" class should exist, but not be eligible for dependency compilation - for example if the path includes `Test`.\n\nBefore this pull request, these would silently fail; after this pull request, an error is shown.","expectedResult":null,"actualResult":null,"source":"pr"},"signatures":[],"labels":{"area":["Framework"],"component":["Setup"],"priority":"P3","severity":null,"reportedOn":[]},"categories":[],"triage":{"model":"@cf/cloudflare/clef","requestHash":"5e773410bd622d2e320bef7a60842fec8ab9bfe48cde02719070f2ce27e18d4f","isBugfix":0.7832,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.8523,"feature":0.083,"refactor":0.0385,"tests_only":0.011,"docs_only":0.0037,"dependency":0.0115},"confidence":0.682},"scope":{"score":1.2442,"probabilities":{"0":0.0893,"1":0.5772,"2":0.3335},"confidence":0.1785},"risk":{"score":0.6842,"probabilities":{"0":0.44,"1":0.4358,"2":0.1242},"confidence":0.0984},"area":{"choice":"framework","probabilities":{"catalog":0.0046,"checkout":0.0029,"customer":0.0021,"admin":0.0089,"graphql_api":0.0017,"framework":0.9714,"frontend":0.003,"other":0.0054},"confidence":0.9358},"securityRelevant":0.1055,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.004,"2.4.0-p1":0.0047,"2.4.1":0.005,"2.4.1-p1":0.0048,"2.4.2":0.0064,"2.4.2-p1":0.0059,"2.4.2-p2":0.007,"2.4.3":0.0121,"2.4.3-p1":0.0133,"2.4.3-p2":0.0138,"2.4.3-p3":0.0078,"2.4.4":0.0158,"2.4.4-p1":0.0093,"2.4.4-p10":0.0082,"2.4.4-p11":0.0095,"2.4.4-p12":0.0074,"2.4.4-p13":0.0075,"2.4.4-p14":0.0101,"2.4.4-p15":0.0066,"2.4.4-p16":0.0084,"2.4.4-p17":0.0073,"2.4.4-p18":0.0062,"2.4.4-p2":0.0028,"2.4.4-p3":0.0031,"2.4.4-p4":0.0033,"2.4.4-p5":0.0044,"2.4.4-p6":0.0043,"2.4.4-p7":0.0058,"2.4.4-p8":0.0045,"2.4.4-p9":0.004,"2.4.5":0.0159,"2.4.5-p1":0.0154,"2.4.5-p10":0.008,"2.4.5-p11":0.0187,"2.4.5-p12":0.0106,"2.4.5-p13":0.0098,"2.4.5-p14":0.0099,"2.4.5-p15":0.0076,"2.4.5-p16":0.0081,"2.4.5-p17":0.0085,"2.4.5-p2":0.0041,"2.4.5-p3":0.006,"2.4.5-p4":0.0067,"2.4.5-p5":0.0062,"2.4.5-p6":0.0078,"2.4.5-p7":0.0083,"2.4.5-p8":0.0058,"2.4.5-p9":0.0054,"2.4.6":0.0231,"2.4.6-p1":0.0165,"2.4.6-p10":0.0103,"2.4.6-p11":0.0133,"2.4.6-p12":0.0106,"2.4.6-p13":0.0115,"2.4.6-p14":0.0107,"2.4.6-p15":0.0088,"2.4.6-p2":0.0046,"2.4.6-p3":0.0072,"2.4.6-p4":0.0087,"2.4.6-p5":0.0076,"2.4.6-p6":0.01,"2.4.6-p7":0.0096,"2.4.6-p8":0.006,"2.4.6-p9":0.0047,"2.4.7":0.0171,"2.4.7-p1":0.0167,"2.4.7-p10":0.0109,"2.4.7-p2":0.0084,"2.4.7-p3":0.0154,"2.4.7-p4":0.0186,"2.4.7-p5":0.0177,"2.4.7-p6":0.0194,"2.4.7-p7":0.0137,"2.4.7-p8":0.0104,"2.4.7-p9":0.0074,"2.4.8":0.0198,"2.4.8-p1":0.0153,"2.4.8-p2":0.0162,"2.4.8-p3":0.0152,"2.4.8-p4":0.0162,"2.4.8-p5":0.0161,"2.4.9":0.0226,"unspecified":0.1836},"confidence":0.0321},"backportWorthy":{"score":1.2399,"probabilities":{"0":0.206,"1":0.348,"2":0.446},"confidence":0.0436}},"curated":{"title":"Removes invalid preferences from Catalog and RemoteStorage di.xml","description":"Per the PR body, setup:di:compile can silently fail on invalid preferences, and plugins of the original classes can be rendered useless. The diff only shows the removal of invalid preferences already within the code-base, in Catalog and RemoteStorage di.xml; the exception alerting for preferences that do not exist is not in it.","categories":[],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.7-p10":{"before":"pass","after":"error","adapted":false,"runAt":"2026-10-06T09:29:08.114Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"pass","after":"error","runAt":"2026-10-06T09:29:08.114Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-33161 details"}