[wp-trac] [WordPress Trac] #56887: wp_exif_date2ts throws notice on slash formatted date

WordPress Trac noreply at wordpress.org
Wed Nov 26 15:16:34 UTC 2025


#56887: wp_exif_date2ts throws notice on slash formatted date
-------------------------------------------------+-------------------------
 Reporter:  domainsupport                        |       Owner:  pbearne
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  7.0
Component:  Date/Time                            |     Version:  5.2.3
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-test-   |     Focuses:
  info                                           |
-------------------------------------------------+-------------------------
Changes (by nikunj8866):

 * keywords:  has-patch has-unit-tests needs-testing => has-patch has-unit-
     tests has-test-info


Comment:

 == Test Report
 === Description
 ✅ This report validates that the indicated patch works as expected. The
 patch ensures that EXIF dates using slash-formatted values (e.g.,
 YYYY/MM/DD HH:MM:SS) no longer trigger PHP warnings in wp_exif_date2ts().

 Patch tested: https://github.com/WordPress/wordpress-develop/pull/8884

 === Steps to Reproduce
 1. Add the following test code to your site (mu-plugin or snippet):

 {{{
 add_action( 'init', function () {
     if ( isset( $_GET['testing'] ) && '56887' === $_GET['testing'] ) {
         require_once ABSPATH . 'wp-admin/includes/image.php';

         $date = '2025/11/12 14:30:00';
         echo 'Input: ' . $date . '<br>';

         $timestamp = wp_exif_date2ts( $date );

         echo 'Formatted: ' . date( 'Y-m-d H:i:s', $timestamp );
         exit;
     }
 });
 }}}

 2. Visit: https://YOUR-SITE.COM/?testing=56887
 3. Compare the behavior **before** and **after** applying the patch.

 === Environment
 - WordPress: 6.8.3
 - PHP: 8.4.10
 - Server: nginx/1.26.1
 - Database: mysqli (Server: 8.0.35 / Client: mysqlnd 8.4.10)
 - Browser: Chrome 142.0.0.0
 - OS: Windows 10/11
 - Theme: Astra 4.11.13
 - MU Plugins:
 - Plugins:
   * Test Reports 1.0.0

 === Actual Results
 1. ✅ The issue is resolved with the patch.
 2. Slash-formatted EXIF dates (2025/11/12 14:30:00) no longer trigger
 warnings.

 === Additional Notes
 🐞 The formatted output shows a 2-hour difference:

 {{{
 Input:     2025/11/12 14:30:00
 Formatted: 2025-11-12 12:30:00
 }}}

 Not sure whether this is expected behavior after the patch.


 === Supplemental Artifacts
 Before: https://prnt.sc/V-DuRxcqEoZR
 After: https://prnt.sc/G3X38HcCKNC-

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56887#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list