OSDN Git Service

Rename 'hex2bin' to 'pkwk_hex2bin' because of PHP 5.4+ compatibility
authorumorigu <umorigu@gmail.com>
Sun, 1 Jun 2014 20:50:11 +0000 (05:50 +0900)
committerumorigu <umorigu@gmail.com>
Sun, 1 Jun 2014 20:50:11 +0000 (05:50 +0900)
PHP 5.4 has embedded 'hex2bin', so the pukiwiki-original 'hex2bin'
needs to be given another name.

lib/auth.php
lib/func.php

index 6a21584..481796a 100644 (file)
@@ -75,7 +75,7 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE
        // LDAP MD5
        case '{md5}'         :
                $hash = ($prefix ? ($canonical ? '{MD5}' : $scheme) : '') .
-                       base64_encode(hex2bin(md5($phrase)));
+                       base64_encode(pkwk_hex2bin(md5($phrase)));
                break;
 
        // LDAP SMD5
@@ -83,13 +83,13 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE
                // MD5 Key length = 128bits = 16bytes
                $salt = ($salt != '' ? substr(base64_decode($salt), 16) : substr(crypt(''), -8));
                $hash = ($prefix ? ($canonical ? '{SMD5}' : $scheme) : '') .
-                       base64_encode(hex2bin(md5($phrase . $salt)) . $salt);
+                       base64_encode(pkwk_hex2bin(md5($phrase . $salt)) . $salt);
                break;
 
        // LDAP SHA
        case '{sha}'         :
                $hash = ($prefix ? ($canonical ? '{SHA}' : $scheme) : '') .
-                       base64_encode(hex2bin(sha1($phrase)));
+                       base64_encode(pkwk_hex2bin(sha1($phrase)));
                break;
 
        // LDAP SSHA
@@ -97,7 +97,7 @@ function pkwk_hash_compute($phrase = '', $scheme = '{x-php-md5}', $prefix = TRUE
                // SHA-1 Key length = 160bits = 20bytes
                $salt = ($salt != '' ? substr(base64_decode($salt), 20) : substr(crypt(''), -8));
                $hash = ($prefix ? ($canonical ? '{SSHA}' : $scheme) : '') .
-                       base64_encode(hex2bin(sha1($phrase . $salt)) . $salt);
+                       base64_encode(pkwk_hex2bin(sha1($phrase . $salt)) . $salt);
                break;
 
        // LDAP CLEARTEXT and just cleartext
index 92e1fd6..d760dfe 100644 (file)
@@ -304,11 +304,11 @@ function encode($key)
 // Decode page name
 function decode($key)
 {
-       return hex2bin($key);
+       return pkwk_hex2bin($key);
 }
 
 // Inversion of bin2hex()
-function hex2bin($hex_string)
+function pkwk_hex2bin($hex_string)
 {
        // preg_match : Avoid warning : pack(): Type H: illegal hex digit ...
        // (string)   : Always treat as string (not int etc). See BugTrack2/31