Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2018-07-16 00:56:57 -05:00
commit 49e0b860de

View File

@ -2092,7 +2092,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
*/
function validateDate($date = null)
@ -2102,7 +2102,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'];
@ -2111,6 +2111,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())):