iliaa Sun Aug 20 18:20:59 2006 UTC Modified files: /php-src/ext/standard datetime.c /php-src/ext/standard/tests/time bug38524.phpt Log: MFB: Fixed bug #38524 (strptime() does not initialize the internal date storage structure). http://cvs.php.net/viewvc.cgi/php-src/ext/standard/datetime.c?r1=1.137&r2=1.138&diff_format=u Index: php-src/ext/standard/datetime.c diff -u php-src/ext/standard/datetime.c:1.137 php-src/ext/standard/datetime.c:1.138 --- php-src/ext/standard/datetime.c:1.137 Sun Jan 1 13:09:55 2006 +++ php-src/ext/standard/datetime.c Sun Aug 20 18:20:59 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: datetime.c,v 1.137 2006/01/01 13:09:55 sniper Exp $ */ +/* $Id: datetime.c,v 1.138 2006/08/20 18:20:59 iliaa Exp $ */ #if HAVE_STRPTIME #define _XOPEN_SOURCE @@ -101,6 +101,8 @@ return; } + memset(&parsed_time, 0, sizeof(parsed_time)); + unparsed_part = strptime(ts, format, &parsed_time); if (unparsed_part == NULL) { RETURN_FALSE; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/time/bug38524.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/time/bug38524.phpt diff -u /dev/null php-src/ext/standard/tests/time/bug38524.phpt:1.2 --- /dev/null Sun Aug 20 18:20:59 2006 +++ php-src/ext/standard/tests/time/bug38524.phpt Sun Aug 20 18:20:59 2006 @@ -0,0 +1,29 @@ +--TEST-- +Bug #38524 (strptime() does not initialize the internal date storage structure) +--FILE-- +<?php + var_dump(strptime('2006-08-20', '%Y-%m-%d')); +?> +===DONE=== +--EXPECT-- +array(9) { + ["tm_sec"]=> + int(0) + ["tm_min"]=> + int(0) + ["tm_hour"]=> + int(0) + ["tm_mday"]=> + int(20) + ["tm_mon"]=> + int(7) + ["tm_year"]=> + int(106) + ["tm_wday"]=> + int(0) + ["tm_yday"]=> + int(231) + ["unparsed"]=> + string(0) "" +} +===DONE===
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php