Skip to content

Commit

Permalink
Fixing #5648 - Time Zone issues with GMT/Etc+Fraction
Browse files Browse the repository at this point in the history
Fractional time offsets can cause huge webserver error-logs
  • Loading branch information
TheWitness committed Jan 28, 2024
1 parent 8fd86aa commit 866ae4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Cacti CHANGELOG
1.2.27
-issue#5622: Errors and deprecation warnings with PHP 8.3.0
-issue#5638: Add tooltip info about IPv6 address
-issue#5648: Fractional time offsets can cause huge webserver error-logs
-issue#5649: Inapprorpiate use of PHP_OS in lib/ping.php on Windows Platform

1.2.26
Expand Down
6 changes: 4 additions & 2 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8415,8 +8415,10 @@ function cacti_time_zone_set($gmt_offset) {
$php_offset = $zone;
ini_set('date.timezone', $zone);
} else {
$php_offset = 'Etc/GMT' . ($hours > 0 ? '-':'+') . abs($hours);
ini_set('date.timezone', 'Etc/GMT' . ($hours > 0 ? '-':'+') . abs($hours));
// Adding the rounding function as some timezones are Etc/GMT+5.5 which is
// not supported in PHP yet.
$php_offset = 'Etc/GMT' . ($hours > 0 ? '-':'+') . abs(round($hours));
ini_set('date.timezone', 'Etc/GMT' . ($hours > 0 ? '-':'+') . abs(round($hours)));
}

$_SESSION[SESS_BROWSER_SYSTEM_TZ] = $sys_offset;
Expand Down

0 comments on commit 866ae4e

Please sign in to comment.