Changeset 59040
- Timestamp:
- 09/17/2024 11:22:43 PM (3 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r58933 r59040 1305 1305 * Parses an RFC3339 time into a Unix timestamp. 1306 1306 * 1307 * Explicitly check for `false` to detect failure, as zero is a valid return 1308 * value on success. 1309 * 1307 1310 * @since 4.4.0 1308 1311 * … … 1370 1373 $date = rest_parse_date( $date ); 1371 1374 1372 if ( empty( $date )) {1375 if ( false === $date ) { 1373 1376 return null; 1374 1377 } … … 2260 2263 2261 2264 case 'date-time': 2262 if ( !rest_parse_date( $value ) ) {2265 if ( false === rest_parse_date( $value ) ) { 2263 2266 return new WP_Error( 'rest_invalid_date', __( 'Invalid date.' ) ); 2264 2267 } -
trunk/tests/phpunit/tests/rest-api/rest-schema-validation.php
r55457 r59040 1019 1019 $this->assertWPError( $error ); 1020 1020 $this->assertSame( 'Invalid date.', $error->get_error_message() ); 1021 } 1022 1023 /** 1024 * @ticket 60184 1025 */ 1026 public function test_epoch() { 1027 $schema = array( 1028 'type' => 'string', 1029 'format' => 'date-time', 1030 ); 1031 $this->assertTrue( rest_validate_value_from_schema( '1970-01-01T00:00:00Z', $schema ) ); 1021 1032 } 1022 1033
Note: See TracChangeset
for help on using the changeset viewer.