]> granicus.if.org Git - php/commitdiff
Fixed bug #64359 strftime crash with VS2012
authorAnatol Belski <ab@php.net>
Wed, 6 Mar 2013 11:37:57 +0000 (12:37 +0100)
committerAnatol Belski <ab@php.net>
Wed, 6 Mar 2013 11:37:57 +0000 (12:37 +0100)
NEWS
ext/date/php_date.c

diff --git a/NEWS b/NEWS
index a5b11c0d3263d1a0c7c1cdb1c16877b68dcfd4e9..6ac84183b1f6c9781e3d371861c49bb179385888 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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:
index f4115dc7e1d21d57b737a412633442f964fc403d..418747c298fa6158323db2f191804ac895db24e7 100644 (file)
@@ -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;