mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-29 15:44:27 +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:
@@ -302,4 +302,25 @@ class Tests_WPInsertPost extends WP_UnitTestCase {
|
||||
$this->assertSame( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 25347
|
||||
*/
|
||||
function test_scheduled_post_with_a_past_date_should_be_published() {
|
||||
|
||||
$now = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) );
|
||||
|
||||
$post_id = $this->factory()->post->create( [
|
||||
'post_date_gmt' => $now->modify( '-1 year' )->format( 'Y-m-d H:i:s' ),
|
||||
'post_status' => 'future',
|
||||
] );
|
||||
|
||||
$this->assertEquals( 'publish', get_post_status( $post_id ) );
|
||||
|
||||
$post_id = $this->factory()->post->create( [
|
||||
'post_date_gmt' => $now->modify( '+50 years' )->format( 'Y-m-d H:i:s' ),
|
||||
'post_status' => 'future',
|
||||
] );
|
||||
|
||||
$this->assertEquals( 'future', get_post_status( $post_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user