Skip to content

Commit cb80655

Browse files
committed
Merge branch 'PHP-5.5'
* PHP-5.5: Fixed bug #64359 strftime crash with VS2012
2 parents 9ccf470 + 371000a commit cb80655

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ext/date/php_date.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,17 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
15741574
long timestamp = 0;
15751575
struct tm ta;
15761576
int max_reallocs = 5;
1577-
size_t buf_len = 64, real_len;
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;
15781588
timelib_time *ts;
15791589
timelib_tzinfo *tzi;
15801590
timelib_time_offset *offset = NULL;

0 commit comments

Comments
 (0)