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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 02 22:01:27 2025 UTC