[wp-trac] [WordPress Trac] #54186: Cast string to int in `wp_checkdate`

WordPress Trac noreply at wordpress.org
Sun Sep 26 11:29:11 UTC 2021


#54186: Cast string to int in `wp_checkdate`
--------------------------+----------------------------------------
 Reporter:  swissspidy    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Date/Time     |    Version:
 Severity:  normal        |   Keywords:  needs-patch good-first-bug
  Focuses:                |
--------------------------+----------------------------------------
 I am currently getting some PHP warnings when running integration tests
 against core:

 > PHP Warning:  checkdate() expects parameter 1 to be int, string given in
 /tmp/wordpress/wp-includes/functions.php on line 6903

 As it turns out, `wp_resolve_post_date()` extracts year/month/day from a
 post date (which is a string) and passes it to `wp_checkdate` (and from
 there to `checkdate()`), which requires `int`s.

 To avoid these warnings, the input arguments should be cast to integers.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54186>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list