Add safeguards for when ext/hash is not compiled with PHP.

see #29518, for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@29751 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2014-09-20 17:27:46 +00:00
parent 5b2c58d5b3
commit 4c1462f2ff
2 changed files with 14 additions and 3 deletions

View File

@@ -61,7 +61,12 @@ abstract class WP_Session_Tokens {
* @return string A hash of the session token (a verifier).
*/
final private function hash_token( $token ) {
return hash( 'sha256', $token );
// If ext/hash is not present, use sha1() instead.
if ( function_exists( 'hash' ) ) {
return hash( 'sha256', $token );
} else {
return sha1( $token );
}
}
/**