{"data":{"id":"magento2-40003","source":"github-pr","sourceRef":"magento/magento2#40003","title":"magento/magento2#39959 catalog_product_save_before observer throws date-related error when using REST API without store-level values (getFinalPrice() issue)","pr":{"number":40003,"url":"https://github.com/magento/magento2/pull/40003","author":"KrasnoshchokBohdan","mergedAt":"2025-08-07T18:24:22Z","mergeCommit":"643eb35cb1910d9bf191e20f36b13df835fb5ebc","headCommit":"a19223c64858ffb78e37551b431cfe89f2e96ba2","baseRef":"2.4-develop","diffSha256":"dfef7b85cd9b43aef929e8a90b8c0cfb3d4beed698f47aa5bed558a1c666a830"},"issues":[],"fixedIn":"2.4.9","containingTags":["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":"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":"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","2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5"],"components":["magento/module-catalog"],"files":[{"path":"app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php","change":"modified","package":"magento/module-catalog"}],"stripped":{"tests":["app/code/Magento/Catalog/Test/Unit/Observer/SetSpecialPriceStartDateTest.php","dev/tests/integration/testsuite/Magento/Catalog/Model/Product/SpecialPriceTest.php"],"docs":[],"outsideCode":[]},"linesChanged":9,"mergeBatched":false,"excluded":null,"sections":{"description":"I focused on investigation error \n`TypeError: strtotime(): Argument #1 ($datetime) must be of type string, DateTime given in lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php:275` \nthe reason for it must be \n\\Magento\\Catalog\\Observer\\SetSpecialPriceStartDate::execute\n<img width=\"1132\" alt=\"image\" src=\"https://github.com/user-attachments/assets/7c0d35f0-c658-4c02-b4ab-3e7e41f31ee2\" />","stepsToReproduce":"1. Create a custom module with an observer for catalog_product_save_before.\n2. Inside the observer, call $product->getFinalPrice().\n3. Save product from storeview scope from admin panel (check the video from issue description)\n4. Save a product using REST API: POST /rest/default/V1/products\n5. Use the following JSON payload (no store-level pricing):\n<details>\n  <summary>payload</summary>\n\n```json\n{\n  \"product\": {\n    \"sku\": \"testing-special-date\",\n    \"price\": 120,\n    \"status\": 0,\n    \"visibility\": 4,\n    \"type_id\": \"simple\",\n    \"extension_attributes\": {\n      \"stock_item\": {\n        \"stock_id\": 1,\n        \"qty\": 207,\n        \"is_in_stock\": true\n      }\n    },\n    \"custom_attributes\": [\n      {\n        \"attribute_code\": \"tax_class_id\",\n        \"value\": \"2\"\n      },\n      {\n        \"attribute_code\": \"special_price\",\n        \"value\": \"100.00\"\n      }\n    ]\n  },\n  \"saveOptions\": true\n}\n```\n</details>","expectedResult":null,"actualResult":null,"source":"pr"},"signatures":[],"labels":{"area":[],"component":[],"priority":null,"severity":null,"reportedOn":[]},"categories":[],"triage":{"model":"@cf/cloudflare/clef","requestHash":"28aa87e56e69f7a12376d1584ef222d4280a59a4f98ffca67ca3c45d7e922454","isBugfix":0.9728,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9578,"feature":0.0048,"refactor":0.0121,"tests_only":0.0085,"docs_only":0.0033,"dependency":0.0033,"cleanup":0.0102},"confidence":0.9039},"scope":{"score":0.8203,"probabilities":{"0":0.3584,"1":0.4629,"2":0.1787},"confidence":0.062},"risk":{"score":0.6708,"probabilities":{"0":0.5987,"1":0.1318,"2":0.2695},"confidence":0.1727},"area":{"choice":"catalog","probabilities":{"catalog":0.7656,"checkout":0.0331,"customer":0.0061,"admin":0.0658,"graphql_api":0.0677,"framework":0.039,"frontend":0.0099,"other":0.0128},"confidence":0.5406},"securityRelevant":0.0088,"reportedVersion":{"choice":"2.4.6","probabilities":{"2.4.0":0.0013,"2.4.0-p1":0.0014,"2.4.1":0.0019,"2.4.1-p1":0.002,"2.4.2":0.0031,"2.4.2-p1":0.0028,"2.4.2-p2":0.0033,"2.4.3":0.0071,"2.4.3-p1":0.007,"2.4.3-p2":0.0073,"2.4.3-p3":0.0041,"2.4.4":0.0074,"2.4.4-p1":0.0076,"2.4.4-p10":0.0058,"2.4.4-p11":0.0079,"2.4.4-p12":0.0064,"2.4.4-p13":0.0071,"2.4.4-p14":0.0074,"2.4.4-p15":0.0051,"2.4.4-p16":0.0069,"2.4.4-p17":0.0061,"2.4.4-p18":0.0044,"2.4.4-p2":0.0016,"2.4.4-p3":0.0016,"2.4.4-p4":0.0018,"2.4.4-p5":0.0028,"2.4.4-p6":0.0038,"2.4.4-p7":0.0035,"2.4.4-p8":0.0064,"2.4.4-p9":0.0039,"2.4.5":0.0141,"2.4.5-p1":0.0113,"2.4.5-p10":0.0072,"2.4.5-p11":0.012,"2.4.5-p12":0.01,"2.4.5-p13":0.0093,"2.4.5-p14":0.0093,"2.4.5-p15":0.0065,"2.4.5-p16":0.01,"2.4.5-p17":0.0074,"2.4.5-p2":0.0034,"2.4.5-p3":0.0052,"2.4.5-p4":0.0049,"2.4.5-p5":0.005,"2.4.5-p6":0.0057,"2.4.5-p7":0.0065,"2.4.5-p8":0.0085,"2.4.5-p9":0.0064,"2.4.6":0.0534,"2.4.6-p1":0.0284,"2.4.6-p10":0.0108,"2.4.6-p11":0.0171,"2.4.6-p12":0.0122,"2.4.6-p13":0.0148,"2.4.6-p14":0.0131,"2.4.6-p15":0.0129,"2.4.6-p2":0.0049,"2.4.6-p3":0.0101,"2.4.6-p4":0.0087,"2.4.6-p5":0.0089,"2.4.6-p6":0.0123,"2.4.6-p7":0.0099,"2.4.6-p8":0.0082,"2.4.6-p9":0.009,"2.4.7":0.0447,"2.4.7-p1":0.035,"2.4.7-p10":0.0141,"2.4.7-p2":0.0159,"2.4.7-p3":0.029,"2.4.7-p4":0.0251,"2.4.7-p5":0.018,"2.4.7-p6":0.0241,"2.4.7-p7":0.0216,"2.4.7-p8":0.0169,"2.4.7-p9":0.0118,"2.4.8":0.039,"2.4.8-p1":0.0274,"2.4.8-p2":0.0254,"2.4.8-p3":0.0246,"2.4.8-p4":0.0183,"2.4.8-p5":0.0168,"2.4.9":0.0296,"unspecified":0.0465},"confidence":0.0097},"backportWorthy":{"score":1.6724,"probabilities":{"0":0.0576,"1":0.2124,"2":0.73},"confidence":0.372}},"curated":{"title":"Product save with a special price throws a strtotime TypeError in getFinalPrice","description":"When a product with a special price and no special_from_date is saved, for example using REST API POST /V1/products, a catalog_product_save_before observer that calls getFinalPrice() can get TypeError: strtotime(): Argument #1 ($datetime) must be of type string, DateTime given. The SetSpecialPriceStartDate observer now sets special_from_date as a Y-m-d H:i:s string, not a DateTime instance.","categories":[],"author":"claude-code/opus-5.5","date":"2026-10-07","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-07T15:13:04.532Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-07T15:13:04.532Z"},"integration":{"before":"pass","after":"pass","runAt":"2026-10-07T15:13:04.532Z"}}},"2.4.7-p10":{"before":"fail","after":"error","adapted":false,"runAt":"2026-10-07T15:20:36.015Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-07T15:20:36.015Z"},"integration":{"before":"not-runnable","after":"error","runAt":"2026-10-07T15:20:36.015Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40003 details"}