{"data":{"id":"magento2-38366","source":"github-pr","sourceRef":"magento/magento2#38366","title":"Fatal error thrown on exception constructor when cookies store is an array","pr":{"number":38366,"url":"https://github.com/magento/magento2/pull/38366","author":"andrewbess","mergedAt":"2026-07-09T12:23:46Z","mergeCommit":"929aaf888e89e72e5db3a188730e08e55aa0d955","headCommit":"7ad3f8ec15d46f42783274b6d2eee13fd0a2dcdf","baseRef":"2.4-develop","diffSha256":"8c0418db48bd5de9a4cf9f8d0ba57c7551bcde7140970e8bd84039c3154b08ac"},"issues":[{"number":38365,"url":"https://github.com/magento/magento2/issues/38365","title":"Fatal error thrown on exception constructor when cookies store is an array","labels":["Area: Framework","Component: Store","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: PR in progress","Progress: done","Reported on 2.4.4-p6","Reproduced on 2.4.x","Triage: Dev.Experience"],"kind":"human"}],"fixedIn":null,"containingTags":[],"reportedOn":"2.4.4-p6","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":"conflict","2.4.6-p13":"conflict","2.4.6-p14":"conflict","2.4.6-p15":"conflict","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":"conflict","2.4.7-p8":"conflict","2.4.7-p9":"conflict","2.4.7-p10":"conflict","2.4.8":"clean","2.4.8-p1":"clean","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.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.8","2.4.8-p1"],"components":["magento/module-store"],"files":[{"path":"app/code/Magento/Store/Model/StoreResolver.php","change":"modified","package":"magento/module-store"}],"stripped":{"tests":[],"docs":[],"outsideCode":[]},"linesChanged":6,"mergeBatched":false,"excluded":null,"sections":{"description":"A PHP fatal error is triggered:","stepsToReproduce":"You need to have the `$_COOKIE['store']` to be an array and not contain a valid store code.\n\nI don't know exactly how to set it this way but Magento code is written to handle that situation as you can see here: \n\nhttps://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Store/Model/StoreResolver.php#L108\n\nAfter seeing the fatal error popping up in our logs, I had to manually do : `$_COOKIE['store'] = ['test'];` to replicate the bug.","expectedResult":"The Invalid store parameter. (https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Store/Model/StoreResolver.php#L110) should be thrown","actualResult":"A PHP fatal error is triggered: \n\n    PHP message: PHP Fatal error:  Uncaught TypeError: Exception::__construct(): Argument #1 ($message) must be of type string, Magento\\\\Framework\\\\Phrase given in /var/www/source/vendor/magento/module-store/Model/StoreResolver.php:110","source":"issue"},"signatures":["PHP message: PHP Fatal error: Uncaught TypeError: Exception::__construct(): Argument ($message) must be of type string, Magento\\\\Framework\\\\Phrase given","Reason is the PHP InvalidArgumentException does not accept a \\Magento\\Framework\\Phrase but only a string.","- throw new \\InvalidArgumentException(__('Invalid store parameter.'));","+ throw new \\Magento\\Framework\\Exception\\InvalidArgumentException(__('Invalid store parameter.'));","+ throw new \\InvalidArgumentException('Invalid store parameter.');"],"labels":{"area":["Framework"],"component":["Store"],"priority":"P2","severity":null,"reportedOn":["2.4.4-p6"]},"categories":[],"triage":{"model":"@cf/cloudflare/clef","requestHash":"a7ad30be7dee2c2e08f80ab80434363ed37107fe3dce13a296c9ef93ee179400","isBugfix":0.9764,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9576,"feature":0.0045,"refactor":0.0119,"tests_only":0.007,"docs_only":0.0041,"dependency":0.004,"cleanup":0.0109},"confidence":0.9035},"scope":{"score":0.3314,"probabilities":{"0":0.7134,"1":0.2418,"2":0.0448},"confidence":0.3541},"risk":{"score":0.2549,"probabilities":{"0":0.7922,"1":0.1607,"2":0.0471},"confidence":0.4835},"area":{"choice":"framework","probabilities":{"catalog":0.0465,"checkout":0.0379,"customer":0.0382,"admin":0.0446,"graphql_api":0.0206,"framework":0.4831,"frontend":0.1266,"other":0.2025},"confidence":0.1976},"securityRelevant":0.3616,"reportedVersion":{"choice":"2.4.4-p6","probabilities":{"2.4.0":0.0023,"2.4.0-p1":0.0026,"2.4.1":0.0023,"2.4.1-p1":0.0025,"2.4.2":0.0026,"2.4.2-p1":0.0028,"2.4.2-p2":0.0029,"2.4.3":0.0034,"2.4.3-p1":0.0033,"2.4.3-p2":0.0044,"2.4.3-p3":0.0033,"2.4.4":0.0394,"2.4.4-p1":0.0029,"2.4.4-p10":0.0045,"2.4.4-p11":0.0048,"2.4.4-p12":0.0034,"2.4.4-p13":0.0033,"2.4.4-p14":0.0034,"2.4.4-p15":0.0034,"2.4.4-p16":0.004,"2.4.4-p17":0.0031,"2.4.4-p18":0.0027,"2.4.4-p2":0.0023,"2.4.4-p3":0.0031,"2.4.4-p4":0.0041,"2.4.4-p5":0.0064,"2.4.4-p6":0.6115,"2.4.4-p7":0.0067,"2.4.4-p8":0.0053,"2.4.4-p9":0.0051,"2.4.5":0.0048,"2.4.5-p1":0.0047,"2.4.5-p10":0.0044,"2.4.5-p11":0.0046,"2.4.5-p12":0.0049,"2.4.5-p13":0.005,"2.4.5-p14":0.0053,"2.4.5-p15":0.0047,"2.4.5-p16":0.0045,"2.4.5-p17":0.0045,"2.4.5-p2":0.0029,"2.4.5-p3":0.0035,"2.4.5-p4":0.004,"2.4.5-p5":0.0044,"2.4.5-p6":0.0043,"2.4.5-p7":0.0035,"2.4.5-p8":0.0037,"2.4.5-p9":0.0029,"2.4.6":0.007,"2.4.6-p1":0.007,"2.4.6-p10":0.0043,"2.4.6-p11":0.0049,"2.4.6-p12":0.0051,"2.4.6-p13":0.0047,"2.4.6-p14":0.0051,"2.4.6-p15":0.004,"2.4.6-p2":0.0035,"2.4.6-p3":0.0044,"2.4.6-p4":0.005,"2.4.6-p5":0.0046,"2.4.6-p6":0.0056,"2.4.6-p7":0.0041,"2.4.6-p8":0.0039,"2.4.6-p9":0.0028,"2.4.7":0.0035,"2.4.7-p1":0.0043,"2.4.7-p10":0.0043,"2.4.7-p2":0.0033,"2.4.7-p3":0.0049,"2.4.7-p4":0.006,"2.4.7-p5":0.0061,"2.4.7-p6":0.0063,"2.4.7-p7":0.0062,"2.4.7-p8":0.005,"2.4.7-p9":0.0031,"2.4.8":0.0036,"2.4.8-p1":0.0048,"2.4.8-p2":0.0053,"2.4.8-p3":0.0059,"2.4.8-p4":0.0066,"2.4.8-p5":0.0079,"2.4.9":0.0049,"unspecified":0.0036},"confidence":0.3696},"backportWorthy":{"score":1.643,"probabilities":{"0":0.0715,"1":0.214,"2":0.7145},"confidence":0.3421}},"curated":{"title":"Fixes a fatal TypeError when the store cookie is an array without a valid code","description":"When the store cookie is an array without a valid store code, StoreResolver uses a Phrase as the Exception::__construct() message argument and a PHP fatal error is triggered. StoreResolver now uses render() on the 'Invalid store parameter.' message, so the InvalidArgumentException is thrown as expected.","categories":[],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":null},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-38366 details"}