--- embedaddon/php/ext/date/lib/parse_date.re 2013/07/22 01:31:38 1.1.1.3 +++ embedaddon/php/ext/date/lib/parse_date.re 2014/06/15 20:03:41 1.1.1.5 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: parse_date.re,v 1.1.1.3 2013/07/22 01:31:38 misho Exp $ */ +/* $Id: parse_date.re,v 1.1.1.5 2014/06/15 20:03:41 misho Exp $ */ #include "timelib.h" @@ -401,9 +401,12 @@ static timelib_sll timelib_meridian_with_check(char ** { timelib_sll retval = 0; - while (!strchr("AaPp", **ptr)) { + while (**ptr && !strchr("AaPp", **ptr)) { ++*ptr; } + if(!**ptr) { + return TIMELIB_UNSET; + } if (**ptr == 'a' || **ptr == 'A') { if (h == 12) { retval = -12; @@ -649,7 +652,8 @@ static const timelib_relunit* timelib_lookup_relunit(c char *begin = *ptr, *end; const timelib_relunit *tp, *value = NULL; - while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') { + while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' && + **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) { ++*ptr; } end = *ptr; @@ -749,7 +753,7 @@ const static timelib_tz_lookup_table* zone_search(cons /* Still didn't find anything, let's find the zone solely based on * offset/isdst then */ for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) { - if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) { + if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) { return fmp; } } @@ -2042,7 +2046,7 @@ timelib_time *timelib_parse_from_format(char *format, TIMELIB_CHECK_NUMBER; sec = timelib_get_nr_ex((char **) &ptr, 2, &length); if (sec == TIMELIB_UNSET || length != 2) { - add_pbf_error(s, "A two second minute could not be found", string, begin); + add_pbf_error(s, "A two digit second could not be found", string, begin); } else { s->time->s = sec; } @@ -2130,7 +2134,11 @@ timelib_time *timelib_parse_from_format(char *format, break; case '\\': /* escaped char */ - *fptr++; + if(!fptr[1]) { + add_pbf_error(s, "Escaped character expected", string, begin); + break; + } + fptr++; if (*ptr == *fptr) { ++ptr; } else {