Skip to content

Commit 7fb0142

Browse files
committed
Merge branch 'PHP-5.5'
* PHP-5.5: simplified the previous fix for #64359
2 parents cb80655 + 8589dfb commit 7fb0142

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

ext/date/php_date.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,17 +1574,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
15741574
long timestamp = 0;
15751575
struct tm ta;
15761576
int max_reallocs = 5;
1577-
#ifdef PHP_WIN32
1578-
/* VS2012 has a bug where strftime crash with %z and %Z format when the
1579-
initial buffer is too small. Increasing the buffer size helps in a
1580-
workaround to fixs longer format strings for this VS version.
1581-
http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code
1582-
*/
1583-
size_t buf_len = 256;
1584-
#else
1585-
size_t buf_len = 64;
1586-
#endif
1587-
size_t real_len;
1577+
size_t buf_len = 256, real_len;
15881578
timelib_time *ts;
15891579
timelib_tzinfo *tzi;
15901580
timelib_time_offset *offset = NULL;
@@ -1637,6 +1627,9 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
16371627
#endif
16381628
}
16391629

1630+
/* VS2012 crt has a bug where strftime crash with %z and %Z format when the
1631+
initial buffer is too small. See
1632+
http://connect.microsoft.com/VisualStudio/feedback/details/759720/vs2012-strftime-crash-with-z-formatting-code */
16401633
buf = (char *) emalloc(buf_len);
16411634
while ((real_len=strftime(buf, buf_len, format, &ta))==buf_len || real_len==0) {
16421635
buf_len *= 2;

0 commit comments

Comments
 (0)