{"data":{"id":"magento2-40480","source":"github-pr","sourceRef":"magento/magento2#40480","title":"SELECT from media_storage_file_storage when media DB storage is not in use or disabled","pr":{"number":40480,"url":"https://github.com/magento/magento2/pull/40480","author":"hostep","mergedAt":"2026-05-20T15:36:42Z","mergeCommit":"0a52b629c2f72fdaf49da0d80362783fe2455382","headCommit":"f49f49a7b7935200629ed1a6d6b3312a80715b5e","baseRef":"2.4-develop","diffSha256":"c0b5d6502d1934b529b66c4351679e51ca8f43e00dc4b13bc1a9bcced64df93e"},"issues":[{"number":38116,"url":"https://github.com/magento/magento2/issues/38116","title":"SELECT from media_storage_file_storage when media DB storage is not in use or disabled","labels":["Area: Framework","Component: MediaStorage","Issue: Confirmed","Priority: P3","Progress: PR Created","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x","Triage: Dev.Experience"],"kind":"human"}],"fixedIn":null,"containingTags":[],"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":"clean","2.4.8-p1":"clean","2.4.8-p2":"clean","2.4.8-p3":"clean","2.4.8-p4":"clean","2.4.8-p5":"clean","2.4.9":"clean"},"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","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"],"components":["magento/module-media-storage"],"files":[{"path":"app/code/Magento/MediaStorage/Model/File/Storage/Synchronization.php","change":"modified","package":"magento/module-media-storage"}],"stripped":{"tests":["app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/SynchronizationTest.php"],"docs":[],"outsideCode":[]},"linesChanged":22,"mergeBatched":false,"excluded":null,"sections":{"description":"1. The request triggers the queries to `media_storage_file_storage` table\n2. Mysql service contains warning logs about accessing the table `media_storage_file_storage`  that does not exists\n3. Exceptions are not logged and silently suppressed in `Magento\\MediaStorage\\Model\\File\\Storage\\Synchronization::synchronize`\n4. `Magento\\MediaStorage\\Model\\File\\Storage\\Synchronization::synchronize` does not uses disabled DB media storage","stepsToReproduce":"1. Disable and never use DB media storage\n2. Make sure the table `media_storage_file_storage` does not exists\n![image](https://github.com/magento/magento2/assets/3192770/ebf7fc5d-1fcc-46c9-879f-1ebe597f895e)\n3. Allow nginx to fallback to `pub/get.php` to resolve image\n4. Access non existent image e.g. `https://magento.local/media/wysiwyg/someImage.jpg`","expectedResult":"1. The code execution does not trigger queries to `media_storage_file_storage` table\n2. The user gets placeholder image without triggering `media_storage_file_storage` table\n3. Mysql service does not contain warning logs about accessing the table `media_storage_file_storage`\n4. Exceptions are logged in and not silently suppressed `Magento\\MediaStorage\\Model\\File\\Storage\\Synchronization::synchronize`\n5. `Magento\\MediaStorage\\Model\\File\\Storage\\Synchronization::synchronize` does not use disabled DB media storage","actualResult":"1. The request triggers the queries to `media_storage_file_storage` table\n2. Mysql service contains warning logs about accessing the table `media_storage_file_storage`  that does not exists\n3. Exceptions are not logged and silently suppressed in `Magento\\MediaStorage\\Model\\File\\Storage\\Synchronization::synchronize`\n4. `Magento\\MediaStorage\\Model\\File\\Storage\\Synchronization::synchronize` does not uses disabled DB media storage","source":"issue"},"signatures":["4. Exceptions are logged in and not silently suppressed `Magento\\MediaStorage\\Model\\File\\Storage\\Synchronization::synchronize`","3. Exceptions are not logged and silently suppressed in `Magento\\MediaStorage\\Model\\File\\Storage\\Synchronization::synchronize`","} catch (\\Exception $e) {"],"labels":{"area":["Framework"],"component":["MediaStorage"],"priority":"P3","severity":null,"reportedOn":["2.4.x"]},"categories":[],"triage":{"model":"@cf/cloudflare/clef","requestHash":"359505478a01edf0be14b0c9bd7c52703a25934370317043e6608a38e8c96863","isBugfix":0.9607,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9471,"feature":0.0076,"refactor":0.0289,"tests_only":0.0087,"docs_only":0.0038,"dependency":0.0039},"confidence":0.8776},"scope":{"score":0.7593,"probabilities":{"0":0.3966,"1":0.4474,"2":0.156},"confidence":0.0727},"risk":{"score":0.2462,"probabilities":{"0":0.7857,"1":0.1824,"2":0.0319},"confidence":0.4774},"area":{"choice":"other","probabilities":{"catalog":0.0333,"checkout":0.0155,"customer":0.0157,"admin":0.068,"graphql_api":0.0122,"framework":0.3376,"frontend":0.1322,"other":0.3855},"confidence":0.1845},"securityRelevant":0.006,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0039,"2.4.0-p1":0.0035,"2.4.1":0.0033,"2.4.1-p1":0.0028,"2.4.2":0.0047,"2.4.2-p1":0.004,"2.4.2-p2":0.0059,"2.4.3":0.0066,"2.4.3-p1":0.0092,"2.4.3-p2":0.0091,"2.4.3-p3":0.0061,"2.4.4":0.0088,"2.4.4-p1":0.0055,"2.4.4-p10":0.0043,"2.4.4-p11":0.0052,"2.4.4-p12":0.0047,"2.4.4-p13":0.0049,"2.4.4-p14":0.005,"2.4.4-p15":0.0046,"2.4.4-p16":0.0046,"2.4.4-p17":0.0044,"2.4.4-p18":0.0038,"2.4.4-p2":0.0024,"2.4.4-p3":0.0031,"2.4.4-p4":0.0029,"2.4.4-p5":0.0031,"2.4.4-p6":0.0036,"2.4.4-p7":0.0033,"2.4.4-p8":0.0035,"2.4.4-p9":0.0028,"2.4.5":0.0087,"2.4.5-p1":0.0066,"2.4.5-p10":0.0051,"2.4.5-p11":0.0068,"2.4.5-p12":0.0069,"2.4.5-p13":0.0058,"2.4.5-p14":0.0053,"2.4.5-p15":0.0061,"2.4.5-p16":0.0055,"2.4.5-p17":0.0053,"2.4.5-p2":0.0029,"2.4.5-p3":0.0037,"2.4.5-p4":0.0043,"2.4.5-p5":0.0036,"2.4.5-p6":0.004,"2.4.5-p7":0.0043,"2.4.5-p8":0.0035,"2.4.5-p9":0.0032,"2.4.6":0.0151,"2.4.6-p1":0.0095,"2.4.6-p10":0.0063,"2.4.6-p11":0.0079,"2.4.6-p12":0.0068,"2.4.6-p13":0.0064,"2.4.6-p14":0.0063,"2.4.6-p15":0.0052,"2.4.6-p2":0.0036,"2.4.6-p3":0.0048,"2.4.6-p4":0.0054,"2.4.6-p5":0.0055,"2.4.6-p6":0.0054,"2.4.6-p7":0.006,"2.4.6-p8":0.0043,"2.4.6-p9":0.0036,"2.4.7":0.0139,"2.4.7-p1":0.0078,"2.4.7-p10":0.0077,"2.4.7-p2":0.0048,"2.4.7-p3":0.0078,"2.4.7-p4":0.0109,"2.4.7-p5":0.0083,"2.4.7-p6":0.0113,"2.4.7-p7":0.0087,"2.4.7-p8":0.0056,"2.4.7-p9":0.0047,"2.4.8":0.0131,"2.4.8-p1":0.009,"2.4.8-p2":0.0118,"2.4.8-p3":0.0108,"2.4.8-p4":0.0106,"2.4.8-p5":0.0103,"2.4.9":0.0141,"unspecified":0.4955},"confidence":0.2402},"backportWorthy":{"score":1.2943,"probabilities":{"0":0.1992,"1":0.3073,"2":0.4935},"confidence":0.0665}},"curated":{"title":"Stops a failing database query for missing media files on filesystem storage","description":"When media storage is on the local filesystem and you request a non-existing file, Synchronization::synchronize() triggers an unwanted database query to the media_storage_file_storage table, which will fail because the table doesn't exist. The fix adds a checkDbUsage() check from the Database storage helper and does not query when DB media storage is not in use.","categories":[],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:20:19.540Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:20:19.540Z"}}},"2.4.9":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:20:25.396Z","releaseCommit":"755e34dd689021c5165db9d35ecff74f7dc51527","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:20:25.396Z"}}},"2.4.7-p10":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:29:32.614Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:29:32.614Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40480 details"}