]> granicus.if.org Git - php/commitdiff
simplified the previous fix for #64359
authorAnatol Belski <ab@php.net>
Wed, 6 Mar 2013 15:48:51 +0000 (16:48 +0100)
committerAnatol Belski <ab@php.net>
Wed, 6 Mar 2013 15:48:51 +0000 (16:48 +0100)
ext/date/php_date.c

index 418747c298fa6158323db2f191804ac895db24e7..71958578de9cf915c008adf5c5ab4f8f247b59b3 100644 (file)
@@ -1574,17 +1574,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
        long                 timestamp = 0;
        struct tm            ta;
        int                  max_reallocs = 5;
-#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;
+       size_t               buf_len = 256, real_len;
        timelib_time        *ts;
        timelib_tzinfo      *tzi;
        timelib_time_offset *offset = NULL;
@@ -1637,6 +1627,9 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
 #endif
        }
 
+       /* VS2012 crt has a bug where strftime crash with %z and %Z format when the
+          initial buffer is too small. See
+          http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code */
        buf = (char *) emalloc(buf_len);
        while ((real_len=strftime(buf, buf_len, format, &ta))==buf_len || real_len==0) {
                buf_len *= 2;