Changeset 46975
- Timestamp:
- 12/17/2019 08:45:18 PM (5 years ago)
- Location:
- branches/5.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.3
- Property svn:mergeinfo changed
/trunk merged: 46968-46969
- Property svn:mergeinfo changed
-
branches/5.3/src/wp-includes/post.php
r46553 r46975 3748 3748 3749 3749 if ( 'attachment' !== $post_type ) { 3750 $now = gmdate( 'Y-m-d H:i:s' ); 3751 3750 3752 if ( 'publish' === $post_status ) { 3751 // String comparison to work around far future dates (year 2038+) on 32-bit systems. 3752 if ( $post_date_gmt > gmdate( 'Y-m-d H:i:59' ) ) { 3753 if ( strtotime( $post_date_gmt ) - strtotime( $now ) >= MINUTE_IN_SECONDS ) { 3753 3754 $post_status = 'future'; 3754 3755 } 3755 3756 } elseif ( 'future' === $post_status ) { 3756 if ( $post_date_gmt <= gmdate( 'Y-m-d H:i:59' )) {3757 if ( strtotime( $post_date_gmt ) - strtotime( $now ) < MINUTE_IN_SECONDS ) { 3757 3758 $post_status = 'publish'; 3758 3759 } -
branches/5.3/tests/phpunit/tests/post.php
r46428 r46975 636 636 637 637 /** 638 * @ticket 48145 639 */ 640 function test_wp_insert_post_should_default_to_publish_if_post_date_is_within_59_seconds_from_current_time() { 641 $future_date = gmdate( 'Y-m-d H:i:s', time() + 59 ); 642 $post_id = self::factory()->post->create( 643 array( 644 'post_date' => $future_date, 645 ) 646 ); 647 648 $post = get_post( $post_id ); 649 $this->assertEquals( 'publish', $post->post_status ); 650 $this->assertEquals( $future_date, $post->post_date ); 651 } 652 653 /** 638 654 * @ticket 22944 639 655 */
Note: See TracChangeset
for help on using the changeset viewer.