diff options
author | dAniel hAhler <php-openid@thequod.de> | 2007-12-08 23:40:37 +0000 |
---|---|---|
committer | dAniel hAhler <php-openid@thequod.de> | 2007-12-08 23:40:37 +0000 |
commit | 575f39c0ebb4d539ff8882b8ea39879726d9b7d6 (patch) | |
tree | db6530078b9285170d2465694be069926caf9630 | |
parent | ee6960fbef50e8dbcc951305d5676d77a2e53f37 (diff) | |
download | php-openid-575f39c0ebb4d539ff8882b8ea39879726d9b7d6.zip php-openid-575f39c0ebb4d539ff8882b8ea39879726d9b7d6.tar.gz php-openid-575f39c0ebb4d539ff8882b8ea39879726d9b7d6.tar.bz2 |
[project @ use-time-instead-of-(gm)mktime]
Use time() instead of (gm)mktime(), when used for getting the current
time (called without arguments).
According to "hunk ./Auth/OpenID/Nonce.php 99" gmmktime() for PHP4 is
buggy and using mktime() makes no sense when called without args:
just use time() then directly.
-rw-r--r-- | Auth/OpenID/FileStore.php | 2 | ||||
-rw-r--r-- | Auth/OpenID/Nonce.php | 6 | ||||
-rw-r--r-- | Auth/OpenID/SQLStore.php | 2 | ||||
-rw-r--r-- | Tests/Auth/OpenID/MemStore.php | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/Auth/OpenID/FileStore.php b/Auth/OpenID/FileStore.php index 7f96ca3..f6bf170 100644 --- a/Auth/OpenID/FileStore.php +++ b/Auth/OpenID/FileStore.php @@ -366,7 +366,7 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore { return null; } - if ( abs($timestamp - mktime()) > $Auth_OpenID_SKEW ) { + if ( abs($timestamp - time()) > $Auth_OpenID_SKEW ) { return False; } diff --git a/Auth/OpenID/Nonce.php b/Auth/OpenID/Nonce.php index 1d05dd8..effecac 100644 --- a/Auth/OpenID/Nonce.php +++ b/Auth/OpenID/Nonce.php @@ -74,7 +74,7 @@ function Auth_OpenID_checkTimestamp($nonce_string, } if ($now === null) { - $now = gmmktime(); + $now = time(); } $stamp = $parts[0]; @@ -96,11 +96,11 @@ function Auth_OpenID_mkNonce($when = null) $salt = Auth_OpenID_CryptUtil::randomString( 6, Auth_OpenID_Nonce_CHRS); if ($when === null) { - // It's safe to call mktime() with no arguments; it returns a + // It's safe to call time() with no arguments; it returns a // GMT unix timestamp on PHP 4 and PHP 5. gmmktime() with no // args returns a local unix timestamp on PHP 4, so don't use // that. - $when = mktime(); + $when = time(); } $time_str = gmstrftime(Auth_OpenID_Nonce_TIME_FMT, $when); return $time_str . $salt; diff --git a/Auth/OpenID/SQLStore.php b/Auth/OpenID/SQLStore.php index b4c822b..4bcd7e6 100644 --- a/Auth/OpenID/SQLStore.php +++ b/Auth/OpenID/SQLStore.php @@ -481,7 +481,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { { global $Auth_OpenID_SKEW; - if ( abs($timestamp - mktime()) > $Auth_OpenID_SKEW ) { + if ( abs($timestamp - time()) > $Auth_OpenID_SKEW ) { return False; } diff --git a/Tests/Auth/OpenID/MemStore.php b/Tests/Auth/OpenID/MemStore.php index aa562c3..b70a6dd 100644 --- a/Tests/Auth/OpenID/MemStore.php +++ b/Tests/Auth/OpenID/MemStore.php @@ -117,7 +117,7 @@ class Tests_Auth_OpenID_MemStore { { global $Auth_OpenID_SKEW; - if (abs($timestamp - mktime()) > $Auth_OpenID_SKEW) { + if (abs($timestamp - time()) > $Auth_OpenID_SKEW) { return false; } |