]> granicus.if.org Git - php/commitdiff
Use labs() on long integer
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Jun 2019 09:48:18 +0000 (11:48 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Jun 2019 09:54:13 +0000 (11:54 +0200)
ext/soap/php_encoding.c

index 39b48f4208cafe7a9317a2e22a52553f9c0f8adb..e88012af525ae293c17bf4d2552c7caf8ee1986d 100644 (file)
@@ -2858,7 +2858,9 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
 
                /* Time zone support */
 #ifdef HAVE_STRUCT_TM_TM_GMTOFF
-               snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 ));
+               snprintf(tzbuf, sizeof(tzbuf), "%c%02ld:%02ld",
+                       (ta->tm_gmtoff < 0) ? '-' : '+',
+                       labs(ta->tm_gmtoff / 3600), labs( (ta->tm_gmtoff % 3600) / 60 ));
 #else
 # if defined(__CYGWIN__) || (defined(PHP_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1900)
                snprintf(tzbuf, sizeof(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));