Commit 24a4ba8885 for wordpress.org

commit 24a4ba8885565eca514c7740246cd295c21bd5a5
Author: K. Adam White <kadamwhite@gmail.com>
Date:   Tue Sep 17 23:24:12 2024 +0000

    REST API: Allow posts to be published with a publication date of midnight 1970-01-01.

    Explicitly checks date parsing return values for `false`, so that `0` (the value returned for the UNIX epoch of `1970-01-01 00:00:00`) is correctly treated as a valid timestamp.

    It should be valid to create a post dated to any point in history.

    Props emmanuel78, sabernhardt, siliconforks, drjosh07, antpb, TimothyBlynJacobs.
    Fixes #60184.



    Built from https://develop.svn.wordpress.org/trunk@59040


    git-svn-id: http://core.svn.wordpress.org/trunk@58436 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php
index 9b023e97ec..242b317ca1 100644
--- a/wp-includes/rest-api.php
+++ b/wp-includes/rest-api.php
@@ -1304,6 +1304,9 @@ function rest_get_avatar_sizes() {
 /**
  * Parses an RFC3339 time into a Unix timestamp.
  *
+ * Explicitly check for `false` to detect failure, as zero is a valid return
+ * value on success.
+ *
  * @since 4.4.0
  *
  * @param string $date      RFC3339 timestamp.
@@ -1369,7 +1372,7 @@ function rest_get_date_with_gmt( $date, $is_utc = false ) {

 	$date = rest_parse_date( $date );

-	if ( empty( $date ) ) {
+	if ( false === $date ) {
 		return null;
 	}

@@ -2259,7 +2262,7 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
 				break;

 			case 'date-time':
-				if ( ! rest_parse_date( $value ) ) {
+				if ( false === rest_parse_date( $value ) ) {
 					return new WP_Error( 'rest_invalid_date', __( 'Invalid date.' ) );
 				}
 				break;
diff --git a/wp-includes/version.php b/wp-includes/version.php
index e4dd889496..0547ad31c1 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '6.7-alpha-59039';
+$wp_version = '6.7-alpha-59040';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.