mirror of
https://github.com/danog/tgseclib.git
synced 2025-01-22 05:51:20 +01:00
Merge branch '2.0'
This commit is contained in:
commit
790b9cb22c
@ -1070,7 +1070,7 @@ class X509
|
||||
*
|
||||
* If $date isn't defined it is assumed to be the current date.
|
||||
*
|
||||
* @param int $date optional
|
||||
* @param \DateTime|string $date optional
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
@ -1081,7 +1081,7 @@ class X509
|
||||
}
|
||||
|
||||
if (!isset($date)) {
|
||||
$date = new DateTime($date, new DateTimeZone(@date_default_timezone_get()));
|
||||
$date = new DateTime(null, new DateTimeZone(@date_default_timezone_get()));
|
||||
}
|
||||
|
||||
$notBefore = $this->currentCert['tbsCertificate']['validity']['notBefore'];
|
||||
@ -1090,6 +1090,14 @@ class X509
|
||||
$notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter'];
|
||||
$notAfter = isset($notAfter['generalTime']) ? $notAfter['generalTime'] : $notAfter['utcTime'];
|
||||
|
||||
switch (true) {
|
||||
case is_string($date):
|
||||
$date = new DateTime($date, new DateTimeZone(@date_default_timezone_get()));
|
||||
default:
|
||||
$notBefore = new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get()));
|
||||
$notAfter = new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get()));
|
||||
}
|
||||
|
||||
switch (true) {
|
||||
case $date < new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get())):
|
||||
case $date > new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get())):
|
||||
|
Loading…
x
Reference in New Issue
Block a user