--- embedaddon/php/ext/date/lib/parse_date.c 2013/07/22 01:31:38 1.1.1.3 +++ embedaddon/php/ext/date/lib/parse_date.c 2014/06/15 20:03:41 1.1.1.5 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sun Sep 30 20:14:42 2012 */ +/* Generated by re2c 0.13.5 on Tue May 13 16:52:44 2014 */ /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: parse_date.c,v 1.1.1.3 2013/07/22 01:31:38 misho Exp $ */ +/* $Id: parse_date.c,v 1.1.1.5 2014/06/15 20:03:41 misho Exp $ */ #include "timelib.h" @@ -402,9 +402,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; @@ -650,7 +653,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; @@ -750,7 +754,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; } } @@ -24937,7 +24941,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; } @@ -25025,7 +25029,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 {