mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@45851 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user