diff options
| author | Anatol Belski <ab@php.net> | 2013-03-06 12:37:57 +0100 |
|---|---|---|
| committer | Anatol Belski <ab@php.net> | 2013-03-06 12:37:57 +0100 |
| commit | 371000a877c91cfc11ff3c75ce83826797478569 (patch) | |
| tree | c37b4b8be63dc39980f06d7ad9b466b447bf1baa | |
| parent | 9ed7eab514ae81b90987c8729cf73ef18ecd8f7b (diff) | |
| download | php-git-371000a877c91cfc11ff3c75ce83826797478569.tar.gz | |
Fixed bug #64359 strftime crash with VS2012
| -rw-r--r-- | NEWS | 3 | ||||
| -rw-r--r-- | ext/date/php_date.c | 12 |
2 files changed, 14 insertions, 1 deletions
@@ -13,6 +13,9 @@ PHP NEWS - PCRE: . Merged PCRE 8.32. (Anatol) +- DateTime: + . Fixed bug #64359 (strftime crash with VS2012). (Anatol) + 21 Feb 2013, PHP 5.5.0 Alpha 5 - Core: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index f4115dc7e1..418747c298 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1574,7 +1574,17 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) long timestamp = 0; struct tm ta; int max_reallocs = 5; - size_t buf_len = 64, real_len; +#ifdef PHP_WIN32 + /* VS2012 has a bug where strftime crash with %z and %Z format when the + initial buffer is too small. Increasing the buffer size helps in a + workaround to fixs longer format strings for this VS version. + http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code + */ + size_t buf_len = 256; +#else + size_t buf_len = 64; +#endif + size_t real_len; timelib_time *ts; timelib_tzinfo *tzi; timelib_time_offset *offset = NULL; |
