mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Merge remote-tracking branch 'php/master'
Conflicts: ext/date/lib/parse_date.c
This commit is contained in:
commit
97c5172ac7
2
NEWS
2
NEWS
@ -1,6 +1,6 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 20??, PHP 5.7.0
|
||||
?? ??? 20??, PHP 7.0.0
|
||||
|
||||
- CLI server:
|
||||
. Refactor MIME type handling to use a hash table instead of linear search.
|
||||
|
@ -21,4 +21,4 @@ var_dump($params[0], $params[1]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Redefinition of parameter aaaaaaaa in %sbug54013.php on line 5
|
||||
Fatal error: Redefinition of parameter $aaaaaaaa in %sbug54013.php on line 5
|
||||
|
@ -9,4 +9,4 @@ foo();
|
||||
echo "okey";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Redefinition of parameter unused in %sbug64515.php on line 2
|
||||
Fatal error: Redefinition of parameter $unused in %sbug64515.php on line 2
|
||||
|
11
Zend/tests/bug67856.phpt
Normal file
11
Zend/tests/bug67856.phpt
Normal file
@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #67856 (Leak when using array_reduce with by-ref function)
|
||||
--FILE--
|
||||
<?php
|
||||
$array = [1, 2, 3];
|
||||
var_dump(array_reduce($array, function(&$a, &$b) {
|
||||
return $a + $b;
|
||||
}, 0));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(6)
|
19
Zend/tests/bug67858.phpt
Normal file
19
Zend/tests/bug67858.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #67858: Leak when $php_errormsg already set
|
||||
--INI--
|
||||
track_errors=1
|
||||
error_reporting=E_ALL
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function f() {
|
||||
$php_errormsg = [1, 2, 3];
|
||||
echo $var;
|
||||
var_dump($php_errormsg);
|
||||
}
|
||||
f();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: var in %s on line %d
|
||||
string(23) "Undefined variable: var"
|
@ -1845,7 +1845,7 @@ void zend_do_receive_param(zend_uchar op, znode *varname, znode *initialization,
|
||||
Z_STR(varname->u.constant) = CG(active_op_array)->vars[EX_VAR_TO_NUM(var.u.op.var)];
|
||||
var.EA = 0;
|
||||
if (EX_VAR_TO_NUM(var.u.op.var) != CG(active_op_array)->num_args) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter %s", Z_STRVAL(varname->u.constant));
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter $%s", Z_STRVAL(varname->u.constant));
|
||||
} else if (Z_STRHASH(varname->u.constant) == THIS_HASHVAL &&
|
||||
Z_STRSIZE(varname->u.constant) == sizeof("this")-1 &&
|
||||
!memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")-1)) {
|
||||
|
@ -1724,6 +1724,7 @@ ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int
|
||||
if (op_array->vars[i]->h == h &&
|
||||
op_array->vars[i]->len == len &&
|
||||
memcmp(op_array->vars[i]->val, name, len) == 0) {
|
||||
zval_ptr_dtor(EX_VAR_NUM(i));
|
||||
ZVAL_COPY_VALUE(EX_VAR_NUM(i), value);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* Generated by re2c 0.13.5 on Thu Jul 31 14:33:37 2014 */
|
||||
/* Generated by re2c 0.13.5 on Tue Aug 19 08:27:07 2014 */
|
||||
#line 1 "ext/date/lib/parse_date.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
@ -669,7 +670,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
|
||||
}
|
||||
}
|
||||
|
||||
const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
|
||||
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
|
||||
{
|
||||
int first_found = 0;
|
||||
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
|
||||
@ -697,25 +698,6 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
return first_found_elem;
|
||||
}
|
||||
|
||||
for (tp = timelib_timezone_lookup; tp->name; tp++) {
|
||||
if (tp->full_tz_name && strcasecmp(word, tp->full_tz_name) == 0) {
|
||||
if (!first_found) {
|
||||
first_found = 1;
|
||||
first_found_elem = tp;
|
||||
if (gmtoffset == -1) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
if (tp->gmtoffset == gmtoffset) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (first_found) {
|
||||
return first_found_elem;
|
||||
}
|
||||
|
||||
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
@ -726,7 +708,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
{
|
||||
char *word;
|
||||
char *begin = *ptr, *end;
|
||||
@ -740,7 +722,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
word = calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
if ((tp = zone_search(word, -1, 0))) {
|
||||
if ((tp = abbr_search(word, -1, 0))) {
|
||||
value = -tp->gmtoffset / 60;
|
||||
*dst = tp->type;
|
||||
value += tp->type * 60;
|
||||
@ -784,33 +766,26 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
|
||||
retval = timelib_parse_tz_cor(ptr);
|
||||
} else {
|
||||
int found = 0;
|
||||
long offset;
|
||||
long offset = 0;
|
||||
char *tz_abbr;
|
||||
|
||||
t->is_localtime = 1;
|
||||
|
||||
offset = timelib_lookup_zone(ptr, dst, &tz_abbr, &found);
|
||||
/* First, we lookup by abbreviation only */
|
||||
offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
|
||||
if (found) {
|
||||
t->zone_type = TIMELIB_ZONETYPE_ABBR;
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
#if 0
|
||||
/* If we found a TimeZone identifier, use it */
|
||||
if (tz_name) {
|
||||
t->tz_info = timelib_parse_tzfile(tz_name);
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
}
|
||||
#endif
|
||||
/* If we have a TimeZone identifier to start with, use it */
|
||||
if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) {
|
||||
|
||||
/* Otherwise, we look if we have a TimeZone identifier */
|
||||
if (!found || strcmp("UTC", tz_abbr) == 0) {
|
||||
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
|
||||
t->tz_info = res;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
found++;
|
||||
}
|
||||
}
|
||||
if (found && t->zone_type != TIMELIB_ZONETYPE_ID) {
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
free(tz_abbr);
|
||||
*tz_not_found = (found == 0);
|
||||
retval = offset;
|
||||
@ -839,9 +814,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
#line 940 "ext/date/lib/parse_date.re"
|
||||
|
||||
|
||||
|
||||
#line 822 "ext/date/lib/parse_date.c"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
unsigned int yyaccept = 0;
|
||||
@ -981,6 +958,7 @@ yy2:
|
||||
}
|
||||
yy3:
|
||||
YYDEBUG(3, *YYCURSOR);
|
||||
#line 1620 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
@ -993,6 +971,7 @@ yy3:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIMEZONE;
|
||||
}
|
||||
#line 975 "ext/date/lib/parse_date.c"
|
||||
yy4:
|
||||
YYDEBUG(4, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -1303,10 +1282,12 @@ yy11:
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy12:
|
||||
YYDEBUG(12, *YYCURSOR);
|
||||
#line 1715 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
#line 1291 "ext/date/lib/parse_date.c"
|
||||
yy13:
|
||||
YYDEBUG(13, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -2363,9 +2344,11 @@ yy48:
|
||||
if (yych <= '9') goto yy54;
|
||||
yy49:
|
||||
YYDEBUG(49, *YYCURSOR);
|
||||
#line 1704 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
#line 2352 "ext/date/lib/parse_date.c"
|
||||
yy50:
|
||||
YYDEBUG(50, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -2374,10 +2357,12 @@ yy51:
|
||||
YYDEBUG(51, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(52, *YYCURSOR);
|
||||
#line 1709 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
#line 2366 "ext/date/lib/parse_date.c"
|
||||
yy53:
|
||||
YYDEBUG(53, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -2764,6 +2749,7 @@ yy71:
|
||||
if (yych == 's') goto yy73;
|
||||
yy72:
|
||||
YYDEBUG(72, *YYCURSOR);
|
||||
#line 1688 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
DEBUG_OUTPUT("relative");
|
||||
@ -2778,6 +2764,7 @@ yy72:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 2768 "ext/date/lib/parse_date.c"
|
||||
yy73:
|
||||
YYDEBUG(73, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -3539,6 +3526,7 @@ yy165:
|
||||
}
|
||||
yy166:
|
||||
YYDEBUG(166, *YYCURSOR);
|
||||
#line 1551 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
DEBUG_OUTPUT("daytext");
|
||||
@ -3555,6 +3543,7 @@ yy166:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEKDAY;
|
||||
}
|
||||
#line 3547 "ext/date/lib/parse_date.c"
|
||||
yy167:
|
||||
YYDEBUG(167, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -4074,6 +4063,7 @@ yy192:
|
||||
}
|
||||
yy193:
|
||||
YYDEBUG(193, *YYCURSOR);
|
||||
#line 1610 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("monthtext");
|
||||
TIMELIB_INIT;
|
||||
@ -4082,6 +4072,7 @@ yy193:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 4076 "ext/date/lib/parse_date.c"
|
||||
yy194:
|
||||
YYDEBUG(194, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@ -4132,6 +4123,7 @@ yy197:
|
||||
}
|
||||
yy198:
|
||||
YYDEBUG(198, *YYCURSOR);
|
||||
#line 1356 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
@ -4144,6 +4136,7 @@ yy198:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 4140 "ext/date/lib/parse_date.c"
|
||||
yy199:
|
||||
YYDEBUG(199, *YYCURSOR);
|
||||
yyaccept = 6;
|
||||
@ -4412,6 +4405,7 @@ yy221:
|
||||
}
|
||||
yy222:
|
||||
YYDEBUG(222, *YYCURSOR);
|
||||
#line 1658 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
|
||||
@ -4440,6 +4434,7 @@ yy222:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 4438 "ext/date/lib/parse_date.c"
|
||||
yy223:
|
||||
YYDEBUG(223, *YYCURSOR);
|
||||
yyaccept = 7;
|
||||
@ -5137,6 +5132,7 @@ yy277:
|
||||
YYDEBUG(277, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(278, *YYCURSOR);
|
||||
#line 1634 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
|
||||
TIMELIB_INIT;
|
||||
@ -5159,6 +5155,7 @@ yy277:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
#line 5159 "ext/date/lib/parse_date.c"
|
||||
yy279:
|
||||
YYDEBUG(279, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -5336,6 +5333,7 @@ yy293:
|
||||
++YYCURSOR;
|
||||
yy294:
|
||||
YYDEBUG(294, *YYCURSOR);
|
||||
#line 1328 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
@ -5348,6 +5346,7 @@ yy294:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 5350 "ext/date/lib/parse_date.c"
|
||||
yy295:
|
||||
YYDEBUG(295, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -6567,6 +6566,7 @@ yy361:
|
||||
if (yych <= '9') goto yy364;
|
||||
yy363:
|
||||
YYDEBUG(363, *YYCURSOR);
|
||||
#line 1472 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
@ -6579,6 +6579,7 @@ yy363:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 6583 "ext/date/lib/parse_date.c"
|
||||
yy364:
|
||||
YYDEBUG(364, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -7216,6 +7217,7 @@ yy391:
|
||||
}
|
||||
yy392:
|
||||
YYDEBUG(392, *YYCURSOR);
|
||||
#line 1530 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("ago");
|
||||
TIMELIB_INIT;
|
||||
@ -7235,6 +7237,7 @@ yy392:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AGO;
|
||||
}
|
||||
#line 7241 "ext/date/lib/parse_date.c"
|
||||
yy393:
|
||||
YYDEBUG(393, *YYCURSOR);
|
||||
yyaccept = 5;
|
||||
@ -8984,6 +8987,7 @@ yy453:
|
||||
++YYCURSOR;
|
||||
yy454:
|
||||
YYDEBUG(454, *YYCURSOR);
|
||||
#line 1233 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
|
||||
TIMELIB_INIT;
|
||||
@ -8994,6 +8998,7 @@ yy454:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 9002 "ext/date/lib/parse_date.c"
|
||||
yy455:
|
||||
YYDEBUG(455, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@ -9553,6 +9558,7 @@ yy474:
|
||||
}
|
||||
yy475:
|
||||
YYDEBUG(475, *YYCURSOR);
|
||||
#line 1370 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenoyearrev");
|
||||
TIMELIB_INIT;
|
||||
@ -9563,6 +9569,7 @@ yy475:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_TEXT;
|
||||
}
|
||||
#line 9573 "ext/date/lib/parse_date.c"
|
||||
yy476:
|
||||
YYDEBUG(476, *YYCURSOR);
|
||||
yyaccept = 10;
|
||||
@ -9703,6 +9710,7 @@ yy487:
|
||||
YYDEBUG(487, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(488, *YYCURSOR);
|
||||
#line 1088 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
|
||||
TIMELIB_INIT;
|
||||
@ -9718,6 +9726,7 @@ yy487:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME12;
|
||||
}
|
||||
#line 9730 "ext/date/lib/parse_date.c"
|
||||
yy489:
|
||||
YYDEBUG(489, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@ -9730,6 +9739,7 @@ yy489:
|
||||
}
|
||||
yy490:
|
||||
YYDEBUG(490, *YYCURSOR);
|
||||
#line 1125 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
|
||||
@ -9754,6 +9764,7 @@ yy490:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 9768 "ext/date/lib/parse_date.c"
|
||||
yy491:
|
||||
YYDEBUG(491, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@ -10063,6 +10074,7 @@ yy522:
|
||||
YYDEBUG(522, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(523, *YYCURSOR);
|
||||
#line 1105 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("mssqltime");
|
||||
TIMELIB_INIT;
|
||||
@ -10081,6 +10093,7 @@ yy522:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME24_WITH_ZONE;
|
||||
}
|
||||
#line 10097 "ext/date/lib/parse_date.c"
|
||||
yy524:
|
||||
YYDEBUG(524, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@ -10186,6 +10199,7 @@ yy533:
|
||||
if (yych <= '9') goto yy540;
|
||||
yy534:
|
||||
YYDEBUG(534, *YYCURSOR);
|
||||
#line 1287 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datefull");
|
||||
@ -10199,6 +10213,7 @@ yy534:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL;
|
||||
}
|
||||
#line 10217 "ext/date/lib/parse_date.c"
|
||||
yy535:
|
||||
YYDEBUG(535, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -10935,6 +10950,7 @@ yy604:
|
||||
YYDEBUG(605, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(606, *YYCURSOR);
|
||||
#line 1302 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date YYYY");
|
||||
TIMELIB_INIT;
|
||||
@ -10945,6 +10961,7 @@ yy604:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 10965 "ext/date/lib/parse_date.c"
|
||||
yy607:
|
||||
YYDEBUG(607, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@ -10980,6 +10997,7 @@ yy610:
|
||||
if (yych <= '9') goto yy604;
|
||||
yy611:
|
||||
YYDEBUG(611, *YYCURSOR);
|
||||
#line 1314 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pointed date YY");
|
||||
@ -10992,6 +11010,7 @@ yy611:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_FULL_POINTED;
|
||||
}
|
||||
#line 11014 "ext/date/lib/parse_date.c"
|
||||
yy612:
|
||||
YYDEBUG(612, *YYCURSOR);
|
||||
yyaccept = 11;
|
||||
@ -11632,6 +11651,7 @@ yy655:
|
||||
}
|
||||
yy656:
|
||||
YYDEBUG(656, *YYCURSOR);
|
||||
#line 1273 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
@ -11644,6 +11664,7 @@ yy656:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 11668 "ext/date/lib/parse_date.c"
|
||||
yy657:
|
||||
YYDEBUG(657, *YYCURSOR);
|
||||
yyaccept = 13;
|
||||
@ -11749,6 +11770,7 @@ yy665:
|
||||
}
|
||||
yy666:
|
||||
YYDEBUG(666, *YYCURSOR);
|
||||
#line 1217 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
@ -11763,6 +11785,7 @@ yy666:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_AMERICAN;
|
||||
}
|
||||
#line 11789 "ext/date/lib/parse_date.c"
|
||||
yy667:
|
||||
YYDEBUG(667, *YYCURSOR);
|
||||
yyaccept = 14;
|
||||
@ -11995,6 +12018,7 @@ yy699:
|
||||
if (yych <= ':') goto yy703;
|
||||
yy700:
|
||||
YYDEBUG(700, *YYCURSOR);
|
||||
#line 1500 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("clf");
|
||||
@ -12014,6 +12038,7 @@ yy700:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12042 "ext/date/lib/parse_date.c"
|
||||
yy701:
|
||||
YYDEBUG(701, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -12565,6 +12590,7 @@ yy762:
|
||||
}
|
||||
yy763:
|
||||
YYDEBUG(763, *YYCURSOR);
|
||||
#line 1245 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("iso8601date2");
|
||||
@ -12577,6 +12603,7 @@ yy763:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 12607 "ext/date/lib/parse_date.c"
|
||||
yy764:
|
||||
YYDEBUG(764, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -12615,6 +12642,7 @@ yy770:
|
||||
YYDEBUG(770, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(771, *YYCURSOR);
|
||||
#line 1486 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
@ -12627,6 +12655,7 @@ yy770:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_TEXT;
|
||||
}
|
||||
#line 12659 "ext/date/lib/parse_date.c"
|
||||
yy772:
|
||||
YYDEBUG(772, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -12764,6 +12793,7 @@ yy782:
|
||||
}
|
||||
yy783:
|
||||
YYDEBUG(783, *YYCURSOR);
|
||||
#line 1521 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("year4");
|
||||
TIMELIB_INIT;
|
||||
@ -12771,6 +12801,7 @@ yy783:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_CLF;
|
||||
}
|
||||
#line 12805 "ext/date/lib/parse_date.c"
|
||||
yy784:
|
||||
YYDEBUG(784, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -12921,6 +12952,7 @@ yy792:
|
||||
}
|
||||
yy793:
|
||||
YYDEBUG(793, *YYCURSOR);
|
||||
#line 1342 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
@ -12933,6 +12965,7 @@ yy793:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NO_DAY;
|
||||
}
|
||||
#line 12969 "ext/date/lib/parse_date.c"
|
||||
yy794:
|
||||
YYDEBUG(794, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -13147,6 +13180,7 @@ yy813:
|
||||
if (yych <= '7') goto yy816;
|
||||
yy814:
|
||||
YYDEBUG(814, *YYCURSOR);
|
||||
#line 1453 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweek");
|
||||
@ -13164,6 +13198,7 @@ yy814:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 13202 "ext/date/lib/parse_date.c"
|
||||
yy815:
|
||||
YYDEBUG(815, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -13173,6 +13208,7 @@ yy816:
|
||||
YYDEBUG(816, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(817, *YYCURSOR);
|
||||
#line 1434 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweekday");
|
||||
@ -13190,6 +13226,7 @@ yy816:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_WEEK;
|
||||
}
|
||||
#line 13230 "ext/date/lib/parse_date.c"
|
||||
yy818:
|
||||
YYDEBUG(818, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -13253,6 +13290,7 @@ yy820:
|
||||
}
|
||||
yy821:
|
||||
YYDEBUG(821, *YYCURSOR);
|
||||
#line 1420 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
@ -13265,6 +13303,7 @@ yy821:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PG_YEARDAY;
|
||||
}
|
||||
#line 13307 "ext/date/lib/parse_date.c"
|
||||
yy822:
|
||||
YYDEBUG(822, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -13367,6 +13406,7 @@ yy841:
|
||||
++YYCURSOR;
|
||||
yy842:
|
||||
YYDEBUG(842, *YYCURSOR);
|
||||
#line 1394 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
|
||||
@ -13391,6 +13431,7 @@ yy842:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_XMLRPC_SOAP;
|
||||
}
|
||||
#line 13435 "ext/date/lib/parse_date.c"
|
||||
yy843:
|
||||
YYDEBUG(843, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -13652,6 +13693,7 @@ yy847:
|
||||
}
|
||||
yy848:
|
||||
YYDEBUG(848, *YYCURSOR);
|
||||
#line 1382 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenocolon");
|
||||
TIMELIB_INIT;
|
||||
@ -13662,6 +13704,7 @@ yy848:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_DATE_NOCOLON;
|
||||
}
|
||||
#line 13708 "ext/date/lib/parse_date.c"
|
||||
yy849:
|
||||
YYDEBUG(849, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -14581,6 +14624,7 @@ yy972:
|
||||
if (yych <= '9') goto yy995;
|
||||
yy973:
|
||||
YYDEBUG(973, *YYCURSOR);
|
||||
#line 1259 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int length = 0;
|
||||
DEBUG_OUTPUT("gnudateshorter");
|
||||
@ -14593,6 +14637,7 @@ yy973:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 14641 "ext/date/lib/parse_date.c"
|
||||
yy974:
|
||||
YYDEBUG(974, *YYCURSOR);
|
||||
yyaccept = 22;
|
||||
@ -15601,6 +15646,7 @@ yy1065:
|
||||
}
|
||||
yy1067:
|
||||
YYDEBUG(1067, *YYCURSOR);
|
||||
#line 1151 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("gnunocolon");
|
||||
TIMELIB_INIT;
|
||||
@ -15622,6 +15668,7 @@ yy1067:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_GNU_NOCOLON;
|
||||
}
|
||||
#line 15672 "ext/date/lib/parse_date.c"
|
||||
yy1068:
|
||||
YYDEBUG(1068, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -15713,6 +15760,7 @@ yy1074:
|
||||
}
|
||||
yy1075:
|
||||
YYDEBUG(1075, *YYCURSOR);
|
||||
#line 1197 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("iso8601nocolon");
|
||||
@ -15731,6 +15779,7 @@ yy1075:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_NOCOLON;
|
||||
}
|
||||
#line 15783 "ext/date/lib/parse_date.c"
|
||||
yy1076:
|
||||
YYDEBUG(1076, *YYCURSOR);
|
||||
yyaccept = 25;
|
||||
@ -16628,6 +16677,7 @@ yy1116:
|
||||
}
|
||||
yy1117:
|
||||
YYDEBUG(1117, *YYCURSOR);
|
||||
#line 1593 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@ -16643,6 +16693,7 @@ yy1117:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 16697 "ext/date/lib/parse_date.c"
|
||||
yy1118:
|
||||
YYDEBUG(1118, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
@ -16693,6 +16744,7 @@ yy1125:
|
||||
YYDEBUG(1125, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(1126, *YYCURSOR);
|
||||
#line 1066 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@ -16713,6 +16765,7 @@ yy1125:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_WEEK_DAY_OF_MONTH;
|
||||
}
|
||||
#line 16769 "ext/date/lib/parse_date.c"
|
||||
yy1127:
|
||||
YYDEBUG(1127, *YYCURSOR);
|
||||
yyaccept = 26;
|
||||
@ -16820,6 +16873,7 @@ yy1140:
|
||||
}
|
||||
yy1141:
|
||||
YYDEBUG(1141, *YYCURSOR);
|
||||
#line 1569 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@ -16842,6 +16896,7 @@ yy1141:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 16900 "ext/date/lib/parse_date.c"
|
||||
yy1142:
|
||||
YYDEBUG(1142, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -19518,6 +19573,7 @@ yy1293:
|
||||
goto yy1297;
|
||||
yy1294:
|
||||
YYDEBUG(1294, *YYCURSOR);
|
||||
#line 1043 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("backof | frontof");
|
||||
TIMELIB_INIT;
|
||||
@ -19539,6 +19595,7 @@ yy1294:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 19599 "ext/date/lib/parse_date.c"
|
||||
yy1295:
|
||||
YYDEBUG(1295, *YYCURSOR);
|
||||
yyaccept = 28;
|
||||
@ -19799,13 +19856,14 @@ yy1315:
|
||||
YYDEBUG(1315, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(1316, *YYCURSOR);
|
||||
#line 1026 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("firstdayof | lastdayof");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
/* skip "last day of" or "first day of" */
|
||||
if (*ptr == 'l') {
|
||||
if (*ptr == 'l' || *ptr == 'L') {
|
||||
s->time->relative.first_last_day_of = 2;
|
||||
} else {
|
||||
s->time->relative.first_last_day_of = 1;
|
||||
@ -19814,6 +19872,7 @@ yy1315:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_LF_DAY_OF_MONTH;
|
||||
}
|
||||
#line 19876 "ext/date/lib/parse_date.c"
|
||||
yy1317:
|
||||
YYDEBUG(1317, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@ -21244,6 +21303,7 @@ yy1385:
|
||||
if (yych <= '9') goto yy1385;
|
||||
yy1387:
|
||||
YYDEBUG(1387, *YYCURSOR);
|
||||
#line 1000 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
|
||||
@ -21268,6 +21328,7 @@ yy1387:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21332 "ext/date/lib/parse_date.c"
|
||||
yy1388:
|
||||
YYDEBUG(1388, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -21703,6 +21764,7 @@ yy1416:
|
||||
++YYCURSOR;
|
||||
yy1417:
|
||||
YYDEBUG(1417, *YYCURSOR);
|
||||
#line 988 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("tomorrow");
|
||||
TIMELIB_INIT;
|
||||
@ -21713,6 +21775,7 @@ yy1417:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21779 "ext/date/lib/parse_date.c"
|
||||
yy1418:
|
||||
YYDEBUG(1418, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -21747,6 +21810,7 @@ yy1419:
|
||||
}
|
||||
yy1420:
|
||||
YYDEBUG(1420, *YYCURSOR);
|
||||
#line 978 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("midnight | today");
|
||||
TIMELIB_INIT;
|
||||
@ -21755,6 +21819,7 @@ yy1420:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21823 "ext/date/lib/parse_date.c"
|
||||
yy1421:
|
||||
YYDEBUG(1421, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -23766,6 +23831,7 @@ yy1499:
|
||||
}
|
||||
yy1500:
|
||||
YYDEBUG(1500, *YYCURSOR);
|
||||
#line 957 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("now");
|
||||
TIMELIB_INIT;
|
||||
@ -23773,6 +23839,7 @@ yy1500:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 23843 "ext/date/lib/parse_date.c"
|
||||
yy1501:
|
||||
YYDEBUG(1501, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -23911,6 +23978,7 @@ yy1507:
|
||||
}
|
||||
yy1508:
|
||||
YYDEBUG(1508, *YYCURSOR);
|
||||
#line 966 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("noon");
|
||||
TIMELIB_INIT;
|
||||
@ -23921,6 +23989,7 @@ yy1508:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 23993 "ext/date/lib/parse_date.c"
|
||||
yy1509:
|
||||
YYDEBUG(1509, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@ -24453,6 +24522,7 @@ yy1530:
|
||||
++YYCURSOR;
|
||||
yy1531:
|
||||
YYDEBUG(1531, *YYCURSOR);
|
||||
#line 945 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("yesterday");
|
||||
TIMELIB_INIT;
|
||||
@ -24463,6 +24533,7 @@ yy1531:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 24537 "ext/date/lib/parse_date.c"
|
||||
yy1532:
|
||||
YYDEBUG(1532, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@ -24635,6 +24706,7 @@ yy1537:
|
||||
goto yy1531;
|
||||
}
|
||||
}
|
||||
#line 1719 "ext/date/lib/parse_date.re"
|
||||
|
||||
}
|
||||
|
||||
@ -25125,7 +25197,7 @@ char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
|
||||
{
|
||||
const timelib_tz_lookup_table *tp;
|
||||
|
||||
tp = zone_search(abbr, gmtoffset, isdst);
|
||||
tp = abbr_search(abbr, gmtoffset, isdst);
|
||||
if (tp) {
|
||||
return (tp->full_tz_name);
|
||||
} else {
|
||||
|
@ -668,7 +668,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
|
||||
}
|
||||
}
|
||||
|
||||
const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
|
||||
const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst)
|
||||
{
|
||||
int first_found = 0;
|
||||
const timelib_tz_lookup_table *tp, *first_found_elem = NULL;
|
||||
@ -696,25 +696,6 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
return first_found_elem;
|
||||
}
|
||||
|
||||
for (tp = timelib_timezone_lookup; tp->name; tp++) {
|
||||
if (tp->full_tz_name && strcasecmp(word, tp->full_tz_name) == 0) {
|
||||
if (!first_found) {
|
||||
first_found = 1;
|
||||
first_found_elem = tp;
|
||||
if (gmtoffset == -1) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
if (tp->gmtoffset == gmtoffset) {
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (first_found) {
|
||||
return first_found_elem;
|
||||
}
|
||||
|
||||
|
||||
/* Still didn't find anything, let's find the zone solely based on
|
||||
* offset/isdst then */
|
||||
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
|
||||
@ -725,7 +706,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found)
|
||||
{
|
||||
char *word;
|
||||
char *begin = *ptr, *end;
|
||||
@ -739,7 +720,7 @@ static long timelib_lookup_zone(char **ptr, int *dst, char **tz_abbr, int *found
|
||||
word = calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
if ((tp = zone_search(word, -1, 0))) {
|
||||
if ((tp = abbr_search(word, -1, 0))) {
|
||||
value = -tp->gmtoffset / 60;
|
||||
*dst = tp->type;
|
||||
value += tp->type * 60;
|
||||
@ -783,33 +764,26 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found
|
||||
retval = timelib_parse_tz_cor(ptr);
|
||||
} else {
|
||||
int found = 0;
|
||||
long offset;
|
||||
long offset = 0;
|
||||
char *tz_abbr;
|
||||
|
||||
t->is_localtime = 1;
|
||||
|
||||
offset = timelib_lookup_zone(ptr, dst, &tz_abbr, &found);
|
||||
/* First, we lookup by abbreviation only */
|
||||
offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
|
||||
if (found) {
|
||||
t->zone_type = TIMELIB_ZONETYPE_ABBR;
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
#if 0
|
||||
/* If we found a TimeZone identifier, use it */
|
||||
if (tz_name) {
|
||||
t->tz_info = timelib_parse_tzfile(tz_name);
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
}
|
||||
#endif
|
||||
/* If we have a TimeZone identifier to start with, use it */
|
||||
if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) {
|
||||
|
||||
/* Otherwise, we look if we have a TimeZone identifier */
|
||||
if (!found || strcmp("UTC", tz_abbr) == 0) {
|
||||
if ((res = tz_wrapper(tz_abbr, tzdb)) != NULL) {
|
||||
t->tz_info = res;
|
||||
t->zone_type = TIMELIB_ZONETYPE_ID;
|
||||
found++;
|
||||
}
|
||||
}
|
||||
if (found && t->zone_type != TIMELIB_ZONETYPE_ID) {
|
||||
timelib_time_tz_abbr_update(t, tz_abbr);
|
||||
}
|
||||
free(tz_abbr);
|
||||
*tz_not_found = (found == 0);
|
||||
retval = offset;
|
||||
@ -1055,7 +1029,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
|
||||
/* skip "last day of" or "first day of" */
|
||||
if (*ptr == 'l') {
|
||||
if (*ptr == 'l' || *ptr == 'L') {
|
||||
s->time->relative.first_last_day_of = 2;
|
||||
} else {
|
||||
s->time->relative.first_last_day_of = 1;
|
||||
@ -2232,7 +2206,7 @@ char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst)
|
||||
{
|
||||
const timelib_tz_lookup_table *tp;
|
||||
|
||||
tp = zone_search(abbr, gmtoffset, isdst);
|
||||
tp = abbr_search(abbr, gmtoffset, isdst);
|
||||
if (tp) {
|
||||
return (tp->full_tz_name);
|
||||
} else {
|
||||
|
175
ext/date/tests/bug66985.phpt
Normal file
175
ext/date/tests/bug66985.phpt
Normal file
@ -0,0 +1,175 @@
|
||||
--TEST--
|
||||
Bug #66986 (Some timezones are no longer valid in PHP 5.5.10)
|
||||
--FILE--
|
||||
<?php
|
||||
$zones = array(
|
||||
"CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire",
|
||||
"GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica",
|
||||
"Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland",
|
||||
"Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU",
|
||||
|
||||
"UTC", "GMT", "GMT+0100", "-0230",
|
||||
);
|
||||
|
||||
foreach ( $zones as $zone )
|
||||
{
|
||||
$d = new DateTimeZone( $zone );
|
||||
print_r($d);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => CST6CDT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Cuba
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Egypt
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Eire
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => EST5EDT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Factory
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => GB-Eire
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => GMT0
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Greenwich
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Hongkong
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Iceland
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Iran
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Israel
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Jamaica
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Japan
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Kwajalein
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Libya
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => MST7MDT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Navajo
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => NZ-CHAT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Poland
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Portugal
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => PST8PDT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Singapore
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Turkey
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => Universal
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => W-SU
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 3
|
||||
[timezone] => UTC
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 2
|
||||
[timezone] => GMT
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 1
|
||||
[timezone] => +01:00
|
||||
)
|
||||
DateTimeZone Object
|
||||
(
|
||||
[timezone_type] => 1
|
||||
[timezone] => -02:30
|
||||
)
|
12
ext/date/tests/bug67109.phpt
Normal file
12
ext/date/tests/bug67109.phpt
Normal file
@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #67109 (First uppercase letter breaks date string parsing)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(date('d.m.Y',strtotime('last day of this month')));
|
||||
var_dump(date('d.m.Y',strtotime('Last day of this month')));
|
||||
var_dump(date('d.m.Y',strtotime('lAst Day of This Month')));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(10) "31.08.2014"
|
||||
string(10) "31.08.2014"
|
||||
string(10) "31.08.2014"
|
@ -531,7 +531,7 @@ static int win_cert_verify_callback(X509_STORE_CTX *x509_store_ctx, void *arg) /
|
||||
|
||||
php_stream *stream;
|
||||
php_openssl_netstream_data_t *sslsock;
|
||||
zval **val;
|
||||
zval *val;
|
||||
zend_bool is_self_signed = 0;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
@ -673,7 +673,7 @@ static int win_cert_verify_callback(X509_STORE_CTX *x509_store_ctx, void *arg) /
|
||||
if (chain_policy_status.dwError != 0) {
|
||||
/* The chain does not match the policy */
|
||||
if (is_self_signed && chain_policy_status.dwError == CERT_E_UNTRUSTEDROOT
|
||||
&& GET_VER_OPT("allow_self_signed") && zend_is_true(*val TSRMLS_CC)) {
|
||||
&& GET_VER_OPT("allow_self_signed") && zend_is_true(val TSRMLS_CC)) {
|
||||
/* allow self-signed certs */
|
||||
X509_STORE_CTX_set_error(x509_store_ctx, X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT);
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ if (PHP_PGSQL != "no") {
|
||||
CHECK_HEADER_ADD_INCLUDE("libpq-fe.h", "CFLAGS_PGSQL", PHP_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;" + PHP_PGSQL)) {
|
||||
EXTENSION("pgsql", "pgsql.c");
|
||||
AC_DEFINE('HAVE_PGSQL', 1, 'Have PostgreSQL library');
|
||||
ADD_FLAG("CFLAGS_PGSQL", "/D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS /D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA /D HAVE_PQFTABLE /D HAVE_PQESCAPE_CONN /D HAVE_PQESCAPE_BYTEA_CONN /D HAVE_PQFREEMEM /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT /D HAVE_PQPROTOCOLVERSION /D HAVE_PG_LO_CREATE /D HAVE_PG_LO_IMPORT_WITH_OID /D HAVE_PG_LO_TRUNCATE /D HAVE_PG_LO64 /D HAVE_PQESCAPELITERAL");
|
||||
ADD_FLAG("CFLAGS_PGSQL", "/D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS /D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA /D HAVE_PQFTABLE /D HAVE_PQESCAPE_CONN /D HAVE_PQESCAPE_BYTEA_CONN /D HAVE_PQFREEMEM /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT /D HAVE_PQPROTOCOLVERSION /D HAVE_PG_LO_CREATE /D HAVE_PG_LO_IMPORT_WITH_OID /D HAVE_PG_LO_TRUNCATE /D HAVE_PG_LO64 /D HAVE_PQESCAPELITERAL /D HAVE_PQOIDVALUE");
|
||||
} else {
|
||||
WARNING("pgsql not enabled; libraries and headers not found");
|
||||
}
|
||||
|
@ -1396,8 +1396,8 @@ PHP_METHOD(sqlite3stmt, bindParam)
|
||||
php_sqlite3_stmt *stmt_obj;
|
||||
zval *object = getThis();
|
||||
struct php_sqlite3_bound_param param = {0};
|
||||
stmt_obj = Z_SQLITE3_STMT_P(object);
|
||||
zval *parameter;
|
||||
stmt_obj = Z_SQLITE3_STMT_P(object);
|
||||
|
||||
param.param_number = -1;
|
||||
param.type = SQLITE3_TEXT;
|
||||
@ -1430,8 +1430,8 @@ PHP_METHOD(sqlite3stmt, bindValue)
|
||||
php_sqlite3_stmt *stmt_obj;
|
||||
zval *object = getThis();
|
||||
struct php_sqlite3_bound_param param = {0};
|
||||
stmt_obj = Z_SQLITE3_STMT_P(object);
|
||||
zval *parameter;
|
||||
stmt_obj = Z_SQLITE3_STMT_P(object);
|
||||
|
||||
param.param_number = -1;
|
||||
param.type = SQLITE3_TEXT;
|
||||
|
@ -4298,14 +4298,18 @@ PHP_FUNCTION(array_reduce)
|
||||
fci.no_separation = 0;
|
||||
|
||||
ZEND_HASH_FOREACH_VAL(htbl, operand) {
|
||||
ZVAL_COPY_VALUE(&args[0], &result);
|
||||
ZVAL_COPY_VALUE(&args[1], operand);
|
||||
ZVAL_COPY(&args[0], &result);
|
||||
ZVAL_COPY(&args[1], operand);
|
||||
fci.params = args;
|
||||
|
||||
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
|
||||
zval_ptr_dtor(&args[1]);
|
||||
zval_ptr_dtor(&args[0]);
|
||||
zval_ptr_dtor(&result);
|
||||
ZVAL_COPY_VALUE(&result, &retval);
|
||||
} else {
|
||||
zval_ptr_dtor(&args[1]);
|
||||
zval_ptr_dtor(&args[0]);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the reduction callback");
|
||||
return;
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ static void _xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encodi
|
||||
if (len == 0) {
|
||||
len = _xml_xmlcharlen(s);
|
||||
}
|
||||
ZVAL_STRINGL(ret, (char *)s, len);
|
||||
ZVAL_STR(ret, xml_utf8_decode(s, len, encoding));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -504,8 +504,10 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
|
||||
|
||||
if (in_val) {
|
||||
zval val;
|
||||
XMLRPC_VALUE_TYPE type;
|
||||
|
||||
ZVAL_UNDEF(&val);
|
||||
XMLRPC_VALUE_TYPE type = get_zval_xmlrpc_type(in_val, &val);
|
||||
type = get_zval_xmlrpc_type(in_val, &val);
|
||||
|
||||
if (!Z_ISUNDEF(val)) {
|
||||
switch (type) {
|
||||
@ -1116,6 +1118,7 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data)
|
||||
{
|
||||
zval *handle, *desc;
|
||||
xmlrpc_server_data* server;
|
||||
XMLRPC_VALUE xDesc;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &handle, &desc) == FAILURE) {
|
||||
return;
|
||||
@ -1123,7 +1126,7 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data)
|
||||
|
||||
ZEND_FETCH_RESOURCE(server, xmlrpc_server_data*, handle, -1, "xmlrpc server", le_xmlrpc_server);
|
||||
|
||||
XMLRPC_VALUE xDesc = PHP_to_XMLRPC(desc TSRMLS_CC);
|
||||
xDesc = PHP_to_XMLRPC(desc TSRMLS_CC);
|
||||
if (xDesc) {
|
||||
int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc);
|
||||
XMLRPC_CleanupValue(xDesc);
|
||||
|
Loading…
Reference in New Issue
Block a user