php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44257 [PATCH] timelib_tz_lookup_table must use float for gmtoffset
Submitted: 2008-02-26 20:55 UTC Modified: 2008-03-13 16:00 UTC
From: iuri dot fiedoruk at hp dot com Assigned: derick (profile)
Status: Closed Package: *General Issues
PHP Version: 5.2.5 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: iuri dot fiedoruk at hp dot com
New email:
PHP Version: OS:

 

 [2008-02-26 20:55 UTC] iuri dot fiedoruk at hp dot com
Description:
------------
In ext/date/lib/timelib_struct.h you have:

typedef struct _timelib_tz_lookup_table {
	char       *name;
	int         type;
	int         gmtoffset;
	char       *full_tz_name;
} timelib_tz_lookup_table;

But in ext/date/lib/fallbackmap.h you can notice some timezones are declared with offsets non-integer like:
	{ "ist",   0,  5.5,  "Asia/Calcutta" },

This break get_default_timezone function that reverts to UTC for those values that are non-integer. The fix is easy, just change gmtoffset to float:

typedef struct _timelib_tz_lookup_table {
	char       *name;
	int         type;
	int         gmtoffset;
	char       *full_tz_name;
} timelib_tz_lookup_table;

I've tested under Visual Studio 2005 Express and with this change date_default_timezone_get() works fine now.

If there is a place to send patches, please tell me and I'll gladly submit.

Reproduce code:
---------------
Run date_default_timezone_get() in a Windows machine with a non-integer timezone (for example calcutah +5:30)

Expected result:
----------------
Shold return IST

Actual result:
--------------
Returns UTC

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-13 16:00 UTC] derick@php.net
This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.

Thanks for the patch!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 03:01:30 2024 UTC