{"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":"eb93dcd36828c0a23b3caa164b3a985c7f43afe3571224468018b47fde14c4c9","isBugfix":0.9767,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9665,"feature":0.0047,"refactor":0.0134,"tests_only":0.0066,"docs_only":0.0043,"dependency":0.0045},"confidence":0.9212},"scope":{"score":0.3608,"probabilities":{"0":0.6876,"1":0.264,"2":0.0484},"confidence":0.3173},"risk":{"score":0.2575,"probabilities":{"0":0.7914,"1":0.1598,"2":0.0488},"confidence":0.4813},"area":{"choice":"framework","probabilities":{"catalog":0.0466,"checkout":0.0428,"customer":0.0433,"admin":0.0484,"graphql_api":0.0229,"framework":0.4586,"frontend":0.1325,"other":0.2049},"confidence":0.1756},"securityRelevant":0.3602,"reportedVersion":{"choice":"2.4.4-p6","probabilities":{"2.4.0":0.0024,"2.4.0-p1":0.0026,"2.4.1":0.0023,"2.4.1-p1":0.0026,"2.4.2":0.003,"2.4.2-p1":0.003,"2.4.2-p2":0.003,"2.4.3":0.0037,"2.4.3-p1":0.0034,"2.4.3-p2":0.0046,"2.4.3-p3":0.0034,"2.4.4":0.039,"2.4.4-p1":0.003,"2.4.4-p10":0.0049,"2.4.4-p11":0.0049,"2.4.4-p12":0.0033,"2.4.4-p13":0.0031,"2.4.4-p14":0.0033,"2.4.4-p15":0.0032,"2.4.4-p16":0.0043,"2.4.4-p17":0.0033,"2.4.4-p18":0.0026,"2.4.4-p2":0.0023,"2.4.4-p3":0.0029,"2.4.4-p4":0.0042,"2.4.4-p5":0.0059,"2.4.4-p6":0.6081,"2.4.4-p7":0.0063,"2.4.4-p8":0.005,"2.4.4-p9":0.0047,"2.4.5":0.0047,"2.4.5-p1":0.0044,"2.4.5-p10":0.0042,"2.4.5-p11":0.0043,"2.4.5-p12":0.0047,"2.4.5-p13":0.0044,"2.4.5-p14":0.0045,"2.4.5-p15":0.0044,"2.4.5-p16":0.0045,"2.4.5-p17":0.0045,"2.4.5-p2":0.0028,"2.4.5-p3":0.0035,"2.4.5-p4":0.0037,"2.4.5-p5":0.0038,"2.4.5-p6":0.0039,"2.4.5-p7":0.0034,"2.4.5-p8":0.0036,"2.4.5-p9":0.0027,"2.4.6":0.0067,"2.4.6-p1":0.0072,"2.4.6-p10":0.0045,"2.4.6-p11":0.0056,"2.4.6-p12":0.0052,"2.4.6-p13":0.0048,"2.4.6-p14":0.0059,"2.4.6-p15":0.0043,"2.4.6-p2":0.0037,"2.4.6-p3":0.0049,"2.4.6-p4":0.0055,"2.4.6-p5":0.0052,"2.4.6-p6":0.0057,"2.4.6-p7":0.0043,"2.4.6-p8":0.0045,"2.4.6-p9":0.0031,"2.4.7":0.004,"2.4.7-p1":0.0045,"2.4.7-p10":0.0045,"2.4.7-p2":0.0033,"2.4.7-p3":0.0048,"2.4.7-p4":0.0066,"2.4.7-p5":0.0069,"2.4.7-p6":0.0072,"2.4.7-p7":0.0058,"2.4.7-p8":0.005,"2.4.7-p9":0.0034,"2.4.8":0.004,"2.4.8-p1":0.0048,"2.4.8-p2":0.0052,"2.4.8-p3":0.0058,"2.4.8-p4":0.0067,"2.4.8-p5":0.0072,"2.4.9":0.005,"unspecified":0.0039},"confidence":0.3654},"backportWorthy":{"score":1.6499,"probabilities":{"0":0.0695,"1":0.2111,"2":0.7194},"confidence":0.3504}},"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"}