From: Derick Rethans Date: Tue, 30 Aug 2005 09:17:56 +0000 (+0000) Subject: - Fixed bug #34302 (date('W') do not return leading zeros for week 1 to 9). X-Git-Tag: PRE_NEW_OCI8_EXTENSION~65 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cbe8be6a1713261ff85666b744714a4880ddda40;p=php - Fixed bug #34302 (date('W') do not return leading zeros for week 1 to 9). --- diff --git a/NEWS b/NEWS index 68f740f35c..ee58a55df7 100644 --- a/NEWS +++ b/NEWS @@ -13,3 +13,5 @@ PHP NEWS the part of haystack before or after first occurence of needle. (Johannes) - Fixed a bug where stream_get_meta_data() did not return the "uri" element for files opened with tmpname(). (Derick) +- Fixed bug #34302 (date('W') do not return leading zeros for week 1 to 9). + (Derick) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 6c32a47f1c..9a0421be39 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -492,7 +492,7 @@ static char *date_format(char *format, int format_len, int *return_len, timelib_ case 'z': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%d", (int) timelib_day_of_year(t->y, t->m, t->d)); break; /* week */ - case 'W': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%d", (int) isoweek); break; /* iso weeknr */ + case 'W': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%0d", (int) isoweek); break; /* iso weeknr */ case 'o': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%d", (int) isoyear); break; /* iso year */ /* month */