From: Dmitry Stogov Date: Sat, 5 Mar 2005 13:27:13 +0000 (+0000) Subject: Fixed bug #32115 (dateTime encoding of timezone incorrect) X-Git-Tag: RELEASE_0_3~75 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eff0d6524057c5fc44d8f4f458f0271d6767d8bf;p=php Fixed bug #32115 (dateTime encoding of timezone incorrect) --- diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index ec27db3d90..af78405581 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -2287,7 +2287,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma int max_reallocs = 5; size_t buf_len=64, real_len; char *buf; - char tzbuf[6]; + char tzbuf[8]; xmlNodePtr xmlParam; @@ -2309,19 +2309,19 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma /* Time zone support */ #ifdef HAVE_TM_GMTOFF - sprintf(tzbuf, "%c%02d%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 )); + sprintf(tzbuf, "%c%02d:%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 )); #else # ifdef __CYGWIN__ - sprintf(tzbuf, "%c%02d%02d", ((ta->tm_isdst ? _timezone - 3600:_timezone)>0)?'-':'+', abs((ta->tm_isdst ? _timezone - 3600 : _timezone) / 3600), abs(((ta->tm_isdst ? _timezone - 3600 : _timezone) % 3600) / 60)); + sprintf(tzbuf, "%c%02d:%02d", ((ta->tm_isdst ? _timezone - 3600:_timezone)>0)?'-':'+', abs((ta->tm_isdst ? _timezone - 3600 : _timezone) / 3600), abs(((ta->tm_isdst ? _timezone - 3600 : _timezone) % 3600) / 60)); # else - sprintf(tzbuf, "%c%02d%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs(((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) / 60)); + sprintf(tzbuf, "%c%02d:%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs(((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) / 60)); # endif #endif - if (strcmp(tzbuf,"+0000") == 0) { + if (strcmp(tzbuf,"+00:00") == 0) { strcpy(tzbuf,"Z"); real_len++; } else { - real_len += 5; + real_len += 6; } if (real_len >= buf_len) { buf = (char *) erealloc(buf, real_len+1);