diff --git a/NEWS b/NEWS index 797660d3381..8d59a25d9bb 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,7 @@ PHP NEWS - Fixed bug #51732 (Fileinfo __construct or open does not work with NULL). (Pierre) +- Fixed bug #51725 (xmlrpc_get_type() returns true on invalid dates). (Mike) - Fixed bug #51723 (Content-length header is limited to 32bit integer with Apache2 on Windows). (Pierre) - Fixed bug #51721 (mark DOMNodeList and DOMNamedNodeMap as Traversable). diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 07cfcec2fb5..db15771feb9 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1362,10 +1362,16 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb) PHPAPI signed long php_parse_date(char *string, signed long *now) { timelib_time *parsed_time; + timelib_error_container *error = NULL; int error2; signed long retval; - parsed_time = timelib_strtotime(string, strlen(string), NULL, DATE_TIMEZONEDB); + parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB); + if (error->error_count) { + timelib_error_container_dtor(error); + return -1; + } + timelib_error_container_dtor(error); timelib_update_ts(parsed_time, NULL); retval = timelib_date_to_int(parsed_time, &error2); timelib_time_dtor(parsed_time);