Changeset 65827
- Timestamp:
- 11/30/2026 02:12:25 PM (less than one hour ago)
- Location:
- branches/7.2
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
src/wp-includes/abilities/class-wp-abilities-content.php (modified) (1 diff)
-
tests/phpunit/tests/abilities-api/wpRegisterCoreContentAbility.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/7.2
-
branches/7.2/src/wp-includes/abilities/class-wp-abilities-content.php
r65724 r65827 1771 1771 $date = ( $gmt ? $datetime->setTimezone( new DateTimeZone( 'UTC' ) ) : $datetime )->format( 'c' ); 1772 1772 1773 return rest_parse_date( $date ) ? $date : null;1773 return false !== rest_parse_date( $date ) ? $date : null; 1774 1774 } 1775 1775 -
branches/7.2/tests/phpunit/tests/abilities-api/wpRegisterCoreContentAbility.php
r65724 r65827 5691 5691 5692 5692 /** 5693 * A stored date at the Unix epoch is returned: a timestamp of zero is a date, not a 5694 * date that could not be parsed. 5695 * 5696 * @ticket 66812 5697 * @since 7.2.0 5698 * 5699 * @dataProvider data_date_fields 5700 * 5701 * @param string $field The field path to request, such as `date.site`. 5702 * @param string $column The cached post column to set to the Unix epoch. 5703 */ 5704 public function test_date_at_the_unix_epoch_is_returned( string $field, string $column ): void { 5705 $this->login_as( 'administrator' ); 5706 $this->register_ability(); 5707 5708 $post_id = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 5709 5710 $this->replace_cached_post_date_columns( $post_id, array( $column => '1970-01-01 00:00:00' ) ); 5711 5712 list( $object, $key ) = explode( '.', $field ); 5713 5714 $result = wp_get_ability( 'core/content-query' )->execute( 5715 array( 5716 'where' => array( 5717 'type' => 'post', 5718 'ids' => array( $post_id ), 5719 ), 5720 'fields' => array( 'id', $field ), 5721 ) 5722 ); 5723 5724 $this->assertIsArray( $result, 'A date at the Unix epoch should pass output validation.' ); 5725 $this->assertSame( '1970-01-01T00:00:00+00:00', $result['items'][0][ $object ][ $key ] ?? null, 'A date at the Unix epoch should be returned.' ); 5726 } 5727 5728 /** 5693 5729 * Returns `where.author` values that are not an object holding an ID or a slug: values 5694 5730 * that are not objects, empty values, and objects with an unknown property.
Note:
See TracChangeset
for help on using the changeset viewer.