Date/Time: In `wp_insert_post()`, when checking the post date to set `future` or `publish` status, use string comparison to work around far future dates (year 2038+) on 32-bit systems.
Props Rarst, nofearinc. Fixes #25347. Built from https://develop.svn.wordpress.org/trunk@45851 git-svn-id: http://core.svn.wordpress.org/trunk@45662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3541c5d74c
commit
a58eaa9424
|
@ -3663,14 +3663,13 @@ function wp_insert_post( $postarr, $wp_error = false ) {
|
|||
}
|
||||
|
||||
if ( 'attachment' !== $post_type ) {
|
||||
if ( 'publish' == $post_status ) {
|
||||
$now = gmdate( 'Y-m-d H:i:59' );
|
||||
if ( mysql2date( 'U', $post_date_gmt, false ) > mysql2date( 'U', $now, false ) ) {
|
||||
if ( 'publish' === $post_status ) {
|
||||
// String comparison to work around far future dates (year 2038+) on 32-bit systems.
|
||||
if ( $post_date_gmt > gmdate( 'Y-m-d H:i:59' ) ) {
|
||||
$post_status = 'future';
|
||||
}
|
||||
} elseif ( 'future' == $post_status ) {
|
||||
$now = gmdate( 'Y-m-d H:i:59' );
|
||||
if ( mysql2date( 'U', $post_date_gmt, false ) <= mysql2date( 'U', $now, false ) ) {
|
||||
} elseif ( 'future' === $post_status ) {
|
||||
if ( $post_date_gmt <= gmdate( 'Y-m-d H:i:59' ) ) {
|
||||
$post_status = 'publish';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-45850';
|
||||
$wp_version = '5.3-alpha-45851';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue