|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23071 when trying to use the T flag in date it will crash if DST is in operation
Submitted: 2003-04-06 09:46 UTC Modified: 2003-04-06 17:43 UTC
From: scottmacvicar at ntlworld dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.3.2RC1 OS: Windows XP
Private report: No CVE-ID: None
 [2003-04-06 09:46 UTC] 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.


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 @@
                                strcat(Z_STRVAL_P(return_value), ta->tm_zone);
-                               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]);
+                               }
                        case 'B':       /* Swatch Beat a.k.a. Internet Time */


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-06 17:18 UTC] scottmacvicar at ntlworld dot com

date('T') causes crash when DST is in effect and the DST timezone name is shorter than original timezone name
	if (!date('I')) die('DST not in effect');
string(3) "BST"
 [2003-04-06 17:43 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

Thanks for the patch. (I applied a little bit simpler version though :)

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 09:01:27 2024 UTC