php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21324 Date's convertTZbyID() is buggy
Submitted: 2003-01-01 20:46 UTC Modified: 2003-01-03 06:00 UTC
From: ross at netebb dot com Assigned:
Status: Closed Package: PEAR related
PHP Version: 4CVS-2003-01-01 (dev) OS: any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ross at netebb dot com
New email:
PHP Version: OS:

 

 [2003-01-01 20:46 UTC] ross at netebb dot com
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);
     }
 
     /**

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-03 06:00 UTC] mj@php.net
This bug has been fixed in CVS and the changes will appear in the next release of PEAR::Date.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 13:01:27 2024 UTC