Date/Time: Cast extracted strings to integers in `wp_resolve_post_date()`.

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

Casting the strings to integers avoids PHP notices due to incorrect argument types.

Props hilayt24.
Fixes #54186
Built from https://develop.svn.wordpress.org/trunk@54126


git-svn-id: http://core.svn.wordpress.org/trunk@53685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2022-09-11 21:59:09 +00:00
parent aee27cf6c0
commit 7973933ad6
2 changed files with 4 additions and 4 deletions

View File

@ -4945,9 +4945,9 @@ function wp_resolve_post_date( $post_date = '', $post_date_gmt = '' ) {
}
// Validate the date.
$month = substr( $post_date, 5, 2 );
$day = substr( $post_date, 8, 2 );
$year = substr( $post_date, 0, 4 );
$month = (int) substr( $post_date, 5, 2 );
$day = (int) substr( $post_date, 8, 2 );
$year = (int) substr( $post_date, 0, 4 );
$valid_date = wp_checkdate( $month, $day, $year, $post_date );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-54125';
$wp_version = '6.1-alpha-54126';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.