1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-11 16:49:42 +01:00

ASN1: fix timezone issue when non-utc time is given

This commit is contained in:
danieljankowski 2021-05-04 11:02:29 +02:00 committed by terrafrost
parent 0e3ef812c3
commit b07738814e

View File

@ -1093,7 +1093,10 @@ class File_ASN1
if (!class_exists('DateTime')) {
$value = @gmdate($format, strtotime($source)) . 'Z';
} else {
// if $source does _not_ include timezone information within it then assume that the timezone is GMT
$date = new DateTime($source, new DateTimeZone('GMT'));
// if $source _does_ include timezone information within it then convert the time to GMT
$date->setTimezone(new DateTimeZone('GMT'));
$value = $date->format($format) . 'Z';
}
break;