Ticket #41032: 41032.patch
File 41032.patch, 1.2 KB (added by , 6 years ago) |
---|
-
src/wp-includes/rest-api.php
857 857 } 858 858 859 859 /** 860 * Parses an RFC3339time into a Unix timestamp.860 * Parses an ISO8601 time into a Unix timestamp. 861 861 * 862 862 * @since 4.4.0 863 863 * 864 * @param string $date RFC3339timestamp.864 * @param string $date ISO8601 timestamp. 865 865 * @param bool $force_utc Optional. Whether to force UTC timezone instead of using 866 866 * the timestamp's timezone. Default false. 867 867 * @return int Unix timestamp. … … 871 871 $date = preg_replace( '/[+-]\d+:?\d+$/', '+00:00', $date ); 872 872 } 873 873 874 $regex = '#^\d{4}-\d{2}-\d{2}[Tt ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}(?::\d{2})?)?$#'; 874 $regex = '^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2]) 875 (\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7]) 876 ?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6]))) 877 ([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00) 878 ([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]| 879 ([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$'; 875 880 876 881 if ( ! preg_match( $regex, $date, $matches ) ) { 877 882 return false;