Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,6 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
size_t format_len;
zend_long timestamp = 0;
struct tm ta;
int max_reallocs = 5;
size_t buf_len = 256, real_len;
timelib_time *ts;
timelib_tzinfo *tzi;
Expand Down Expand Up @@ -1691,9 +1690,6 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
while ((real_len = strftime(buf->val, buf_len, format, &ta)) == buf_len || real_len == 0) {
buf_len *= 2;
buf = zend_string_realloc(buf, buf_len, 0);
if (!--max_reallocs) {
break;
}
}
#if defined(PHP_WIN32) && _MSC_VER >= 1700
/* VS2012 strftime() returns number of characters, not bytes.
Expand Down
13 changes: 13 additions & 0 deletions ext/date/tests/bug66777.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Test for bug #66777: strftime returns empty string when input fmt string exceeds 1024
--CREDITS--
Boro Sitnikovski <buritomath@yahoo.com>
--INI--
date.timezone = UTC
--FILE--
<?php
$x = strftime(str_repeat('x', 10240));
var_dump(strlen($x));
?>
--EXPECT--
int(10240)