[wp-trac] [WordPress Trac] #26798: While inserting a post some values for 'post_date' throw a PHP exception

WordPress Trac noreply at wordpress.org
Wed Jul 13 16:04:02 UTC 2022


#26798: While inserting a post some values for 'post_date' throw a PHP exception
-------------------------------------------------+-------------------------
 Reporter:  mobius5150                           |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Date/Time                            |     Version:  3.5
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests changes-    |     Focuses:
  requested                                      |
-------------------------------------------------+-------------------------

Comment (by johnregan3):

 @desrosj In testing, I found that the WP_REST tests use ISO formatted
 dates, so I added support for that. Additionally, this now handles YYYY-
 MM-DD dates differently from YYYY-MM-DD H:i:s so that malformed times
 (when included) do not cause issues. Finally, the tests are now using a
 data provider.

 One last addition over the previous patch: I added intval() validation to
 `wp_checkdate()` to help prevent PHP Errors when invalid data is passed
 into it.  This addresses comment:2 suggestion to "decline to pass invalid
 values to checkdate()"

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


More information about the wp-trac mailing list