#21324 [NEW]: Date's convertTZbyID() is buggy
| From: | ross at netebb dot com | Date: | Thu, 02 Jan 2003 02:46:28 +0000 |
| Subject: | #21324 [NEW]: Date's convertTZbyID() is buggy | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-11998@lists.php.net to get a copy of this message | ||
From: ross@netebb.com
Operating system: any
PHP version: 4CVS-2003-01-01 (dev)
PHP Bug Type: PEAR related
Bug description: Date's convertTZbyID() is buggy
require_once 'Date/Date.php';
$date = new Date(time());
echo $date->format('%A %e of %B, %Y [%R %Z]'),"\n";
$date->convertTZbyID('US/Eastern');
echo $date->format('%A %e of %B, %Y [%R %Z]'),"\n";
produces:
Wednesday 1 of January, 2003 [18:39 PST]
Wednesday 01 of , 2003 [21:39 EST]
This patch will fix it:
Index: Date.php
===================================================================
RCS file: /repository/pear/Date/Date.php,v
retrieving revision 1.7
diff -u -r1.7 Date.php
--- Date.php 12 Nov 2002 18:11:10 -0000 1.7
+++ Date.php 2 Jan 2003 02:41:32 -0000
@@ -532,6 +532,9 @@
list($this->year, $this->month, $this->day) =
sscanf(Date_Calc::daysToDate($d), "%04s%02s%02s");
+ $this->year = intval($this->year);
+ $this->month = intval($this->month);
+ $this->day = intval($this->day);
}
/**
@@ -580,6 +583,9 @@
list($this->year, $this->month, $this->day) =
sscanf(Date_Calc::daysToDate($d), "%04s%02s%02s");
+ $this->year = intval($this->year);
+ $this->month = intval($this->month);
+ $this->day = intval($this->day);
}
/**
--
Edit bug report at http://bugs.php.net/?id=21324&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21324&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21324&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21324&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21324&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21324&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21324&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21324&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21324&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21324&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21324&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21324&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21324&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21324&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21324&r=gnused