Make WordPress Core

Ticket #41032: 41032.patch

File 41032.patch, 1.2 KB (added by nickylimjj, 6 years ago)
  • src/wp-includes/rest-api.php

     
    857857}
    858858
    859859/**
    860  * Parses an RFC3339 time into a Unix timestamp.
     860 * Parses an ISO8601 time into a Unix timestamp.
    861861 *
    862862 * @since 4.4.0
    863863 *
    864  * @param string $date      RFC3339 timestamp.
     864 * @param string $date      ISO8601 timestamp.
    865865 * @param bool   $force_utc Optional. Whether to force UTC timezone instead of using
    866866 *                          the timestamp's timezone. Default false.
    867867 * @return int Unix timestamp.
     
    871871                $date = preg_replace( '/[+-]\d+:?\d+$/', '+00:00', $date );
    872872        }
    873873
    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)?)?)?)?$';
    875880
    876881        if ( ! preg_match( $regex, $date, $matches ) ) {
    877882                return false;