Merge branch '2.0'

This commit is contained in:
terrafrost 2018-07-16 00:57:08 -05:00
commit 790b9cb22c

View File

@ -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())):