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:11 UTC

Return to Bug #51725 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions: 2010-05-12 09:36 UTC | 2010-05-12 09:11 UTC

Developer: mike@php.net


 Index: branches/PHP_5_3/ext/date/php_date.c
 Index: 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 @@
 --- ext/date/php_date.c	(revision 298892)
 +++ ext/date/php_date.c	(working copy)
 @@ -1361,10 +1361,15 @@
   PHPAPI signed long php_parse_date(char *string, signed long *now)
   {
   	timelib_time *parsed_time;
  +	timelib_error_container *error = NULL;
Line 11 (now 11), was 12 lines, now 11 lines

   	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) {
 +	if (error) {
  +		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-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 10:02:09 2014 UTC