#23071 [Opn]: when trying to use the T flag in date it will crash if DST is in operation

From: Date: Sun, 06 Apr 2003 22:18:19 +0000
Subject: #23071 [Opn]: when trying to use the T flag in date it will crash if DST is in operation
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37227@lists.php.net to get a copy of this message
ID: 23071 User updated by: scottmacvicar at ntlworld dot com Reported By: scottmacvicar at ntlworld dot com Status: Open Bug Type: Reproducible crash Operating System: Windows XP PHP Version: 4.3.2RC1 New Comment: bug23071.phpt --TEST-- date('T') causes crash when DST is in effect and the DST timezone name is shorter than original timezone name --SKIPIF-- <?php if (!date('I')) die('DST not in effect'); ?> --FILE-- <?php var_dump(date('T')); ?> --EXPECT-- string(3) "BST" Previous Comments: ------------------------------------------------------------------------ [2003-04-06 09:46:58] scottmacvicar at ntlworld dot com on windows this will crash Apache 2.0.45 using PHP built from this morning. tname[1] value is BST but tname[0] value is GMT Standard Time. <?php date('T'); ?> patch is as follows --- datetime.c Sun Feb 9 17:11:00 2003 +++ datetime.c.patched Sun Apr 6 10:41:52 2003 @@ -540,7 +540,11 @@ #if HAVE_TM_ZONE strcat(Z_STRVAL_P(return_value), ta->tm_zone); #elif HAVE_TZNAME - strcat(Z_STRVAL_P(return_value), tname[0]); + if (ta->tm_isdst > 0 ) { + strcat(Z_STRVAL_P(return_value), tname[1]); + } else { + strcat(Z_STRVAL_P(return_value), tname[0]); + } #endif break; case 'B': /* Swatch Beat a.k.a. Internet Time */ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23071&edit=1

« previous php.bugs (#37227) next »