{"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":"e9721972aa2f0063e2d0046825893ee3fd10d25a597969e36609bf473c6ff5d8","isBugfix":0.9567,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9328,"feature":0.0072,"refactor":0.024,"tests_only":0.0083,"docs_only":0.0034,"dependency":0.0035,"cleanup":0.0208},"confidence":0.8497},"scope":{"score":0.7763,"probabilities":{"0":0.3813,"1":0.4612,"2":0.1575},"confidence":0.0743},"risk":{"score":0.2393,"probabilities":{"0":0.7935,"1":0.1737,"2":0.0328},"confidence":0.4913},"area":{"choice":"other","probabilities":{"catalog":0.0309,"checkout":0.015,"customer":0.015,"admin":0.0624,"graphql_api":0.011,"framework":0.3532,"frontend":0.1357,"other":0.3768},"confidence":0.1892},"securityRelevant":0.0062,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0041,"2.4.0-p1":0.0039,"2.4.1":0.0036,"2.4.1-p1":0.0032,"2.4.2":0.0051,"2.4.2-p1":0.0044,"2.4.2-p2":0.0058,"2.4.3":0.0072,"2.4.3-p1":0.0076,"2.4.3-p2":0.0083,"2.4.3-p3":0.0057,"2.4.4":0.0097,"2.4.4-p1":0.0059,"2.4.4-p10":0.0047,"2.4.4-p11":0.0055,"2.4.4-p12":0.0056,"2.4.4-p13":0.006,"2.4.4-p14":0.0058,"2.4.4-p15":0.005,"2.4.4-p16":0.0052,"2.4.4-p17":0.005,"2.4.4-p18":0.0042,"2.4.4-p2":0.0025,"2.4.4-p3":0.0032,"2.4.4-p4":0.0033,"2.4.4-p5":0.0033,"2.4.4-p6":0.0038,"2.4.4-p7":0.0038,"2.4.4-p8":0.0037,"2.4.4-p9":0.0035,"2.4.5":0.0107,"2.4.5-p1":0.0082,"2.4.5-p10":0.0057,"2.4.5-p11":0.0075,"2.4.5-p12":0.0085,"2.4.5-p13":0.0071,"2.4.5-p14":0.0067,"2.4.5-p15":0.007,"2.4.5-p16":0.0066,"2.4.5-p17":0.0061,"2.4.5-p2":0.0035,"2.4.5-p3":0.0042,"2.4.5-p4":0.0048,"2.4.5-p5":0.0045,"2.4.5-p6":0.0053,"2.4.5-p7":0.0051,"2.4.5-p8":0.004,"2.4.5-p9":0.004,"2.4.6":0.0187,"2.4.6-p1":0.0115,"2.4.6-p10":0.0073,"2.4.6-p11":0.0089,"2.4.6-p12":0.0077,"2.4.6-p13":0.0077,"2.4.6-p14":0.0071,"2.4.6-p15":0.0058,"2.4.6-p2":0.0041,"2.4.6-p3":0.0061,"2.4.6-p4":0.0066,"2.4.6-p5":0.0063,"2.4.6-p6":0.0066,"2.4.6-p7":0.007,"2.4.6-p8":0.0048,"2.4.6-p9":0.004,"2.4.7":0.0172,"2.4.7-p1":0.0102,"2.4.7-p10":0.009,"2.4.7-p2":0.006,"2.4.7-p3":0.0094,"2.4.7-p4":0.0121,"2.4.7-p5":0.0098,"2.4.7-p6":0.0099,"2.4.7-p7":0.0095,"2.4.7-p8":0.0072,"2.4.7-p9":0.0057,"2.4.8":0.0158,"2.4.8-p1":0.011,"2.4.8-p2":0.013,"2.4.8-p3":0.0122,"2.4.8-p4":0.0123,"2.4.8-p5":0.0112,"2.4.9":0.0154,"unspecified":0.4248},"confidence":0.1755},"backportWorthy":{"score":1.3209,"probabilities":{"0":0.1923,"1":0.2945,"2":0.5132},"confidence":0.0806}},"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"}