WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#54186 new defect (bug)

Cast string to int in `wp_checkdate`

Reported by: swissspidy Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Date/Time Keywords: has-patch
Focuses: Cc:

Description

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 ints.

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

Attachments (1)

54186.patch (517 bytes) - added by hilayt24 2 months ago.
Explicitly converted the strings to the integer

Download all attachments as: .zip

Change History (2)

@hilayt24
2 months ago

Explicitly converted the strings to the integer

#1 @hilayt24
2 months ago

  • Keywords has-patch added; needs-patch good-first-bug removed
Note: See TracTickets for help on using tickets.