#23071 [Opn->Csd]: when trying to use the T flag in date it will crash if DST is in operation
ID: 23071
Updated by: sniper@php.net
Reported By: scottmacvicar at ntlworld dot com
-Status: Open
+Status: Closed
Bug Type: Date/time related
Operating System: Windows XP
PHP Version: 4.3.2RC1
New Comment:
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 http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net 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
:)
Previous Comments:
------------------------------------------------------------------------
[2003-04-06 17:18:19] scottmacvicar at ntlworld dot com
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"
------------------------------------------------------------------------
[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
Thread (3 messages)