View Full Version : asia/kolkata timezone not work after update 4.2.5
xman2014
08-10-2017, 07:01 AM
i upgrade my forum with 4.2.5
i am from india and after update timezone show incorrect time
my forum timezone set to +5.30 asia/kolkata but display +5. only
my forum time running delay by 30 minutes
please tell me how can i fix it
Are you sure the time on your actual server (NTP) is not running behind?
Stingray27
08-10-2017, 04:22 PM
You cannot, its basically a bug.
The changes made for php7 mean it will only work with whole hours, not 0.5 hours.
xman2014
08-10-2017, 04:23 PM
You cannot, its basically a bug.
The changes made for php7 mean it will only work with whole hours, not 0.5 hours.
how can i fix it, please help me, i have 2 forum. i have same issue on both forum
Stingray27
08-10-2017, 04:26 PM
how can i fix it
You cannot, its basically a bug.
It would need core code changes in multiple places I think
xman2014
08-11-2017, 05:33 AM
who can make a plugin for me to fix timezone issue on vb4.2.5?
please help me
BirdOPrey5
08-11-2017, 08:46 AM
You cannot, its basically a bug.
The changes made for php7 mean it will only work with whole hours, not 0.5 hours.
It would need core code changes in multiple places I think
I'm looking at the code and comparing it to VB 4.2.3 which I assume worked, but all the code I see had hard coded multiplying the offset by 3600 (which is # of seconds in an hour 60*60) so I don't understand where partial hours come into the code.
Can anyone confirm the last version timezones worked correctly? Did they work in 4.2.4?
VB.com thread- https://www.vbulletin.com/forum/forum/vbulletin-4/vbulletin-4-questions-problems-and-troubleshooting/4375422-incorrect-time-after-update-4-2-5 (in case we get a fix.)
EDIT- I have confirmed the partial hours DO work in VB 4.2.4.
--------------- Added 1502454435 at 1502454435 ---------------
OK it seems:
$vbulletin->userinfo['tzoffset']
is being forced to be an int somewhere in VB 4.2.5.
In VB 4.2.4 it can be a float. 30 minutes would be like 4.5 and 45 minutes would be like 6.25
Still checking code for fix.
--------------- Added 1502461642 at 1502461642 ---------------
OK,
functions.php in the /includes/ directory.
Line 4503:
$tzos = intval($vbulletin->userinfo['timezoneoffset']);
If you remove intval from the code, the time works (you have to set the timezone again after making this change.
It works in the forum and posts. It does NOT work on calendar events, for some reason there are additional intval() functions in the calculator.
I'm going to look deeper into the security ramifications of removing the intval function from this line but a quick glace I see no problem.
--------------- Added 1502462449 at 1502462449 ---------------
So my final determination is to simply change
$tzos = intval($vbulletin->userinfo['timezoneoffset']);
to
$tzos = floatval($vbulletin->userinfo['timezoneoffset']);
on line 4503 of /includes/functions.php to get the time working on most of the site.
Unfortunately I don't see any way to make this a plugin, the manual edit it necessary.
xman2014
08-11-2017, 04:04 PM
I'm looking at the code and comparing it to VB 4.2.3 which I assume worked, but all the code I see had hard coded multiplying the offset by 3600 (which is # of seconds in an hour 60*60) so I don't understand where partial hours come into the code.
Can anyone confirm the last version timezones worked correctly? Did they work in 4.2.4?
VB.com thread- https://www.vbulletin.com/forum/forum/vbulletin-4/vbulletin-4-questions-problems-and-troubleshooting/4375422-incorrect-time-after-update-4-2-5 (in case we get a fix.)
EDIT- I have confirmed the partial hours DO work in VB 4.2.4.
--------------- Added 1502454435 at 1502454435 ---------------
OK it seems:
$vbulletin->userinfo['tzoffset']
is being forced to be an int somewhere in VB 4.2.5.
In VB 4.2.4 it can be a float. 30 minutes would be like 4.5 and 45 minutes would be like 6.25
Still checking code for fix.
--------------- Added 1502461642 at 1502461642 ---------------
OK,
functions.php in the /includes/ directory.
Line 4503:
$tzos = intval($vbulletin->userinfo['timezoneoffset']);
If you remove intval from the code, the time works (you have to set the timezone again after making this change.
It works in the forum and posts. It does NOT work on calendar events, for some reason there are additional intval() functions in the calculator.
I'm going to look deeper into the security ramifications of removing the intval function from this line but a quick glace I see no problem.
--------------- Added 1502462449 at 1502462449 ---------------
So my final determination is to simply change
$tzos = intval($vbulletin->userinfo['timezoneoffset']);
to
$tzos = floatval($vbulletin->userinfo['timezoneoffset']);
on line 4503 of /includes/functions.php to get the time working on most of the site.
Unfortunately I don't see any way to make this a plugin, the manual edit it necessary.
Thanks its work for me.
now time is working perfect but timezone steel show +5
i want to display timezone +5.30
BirdOPrey5
08-12-2017, 01:52 PM
Thanks its work for me.
now time is working perfect but timezone steel show +5
i want to display timezone +5.30
Where is it displaying this? Screenshot?
Paul M
08-12-2017, 05:47 PM
Its a bug.
The code was changed in multiple places due to changes in php 7.1
Unfortunately it wasnt realised that some timezones use 0.5 hours, so intval was used.
This issue wasnt noticed until now, so too late to fix.
As above, the fix would probably be to update all the changes to use floatval.
xman2014
08-13-2017, 03:05 PM
https://vborg.vbsupport.ru/external/2017/08/3.png
i set timezone to +5.30 but its disply +5. only
time is working fine after change from
$tzos = intval($vbulletin->userinfo['timezoneoffset']);
to
$tzos = floatval($vbulletin->userinfo['timezoneoffset']);
but timezone steel not working fine
Stingray27
08-13-2017, 10:34 PM
but timezone steel not working fine
More than one change
the fix would probably be to update all the changes to use floatval.
BirdOPrey5
08-14-2017, 08:34 PM
You may need to re-choose the timezone from the settings as well.
xman2014
08-15-2017, 04:31 PM
You may need to re-choose the timezone from the settings as well.
i re-choose timezone but steel show +5. only not +5.30
same issue like time, timezone not display +-30 and +-45
Stingray27
08-16-2017, 12:16 AM
Its just a display, you are worrying about it too much, that display doesnt do anything else.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.