php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch php_parse_date-return-on-parse-error for XMLRPC-EPI related Bug #51725

Patch version 2010-05-12 09:36 UTC

Return to Bug #51725 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: mike@php.net

Index: branches/PHP_5_3/ext/date/php_date.c
===================================================================
--- branches/PHP_5_3/ext/date/php_date.c	(revision 299276)
+++ branches/PHP_5_3/ext/date/php_date.c	(working copy)
@@ -1362,10 +1362,16 @@
 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);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 17:01:29 2024 UTC