PHP74兼容性问题

修复一处导致PHP74无法正常执行的符号
pull/412/head
Bob Lu 2020-03-28 18:50:44 +08:00 committed by GitHub
parent d127431303
commit 249d564821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1028,7 +1028,7 @@ function des_encode($key, $text){
return base64_encode($encrypted);
}
function pkcs5_unpad($text){
$pad = ord($text{strlen($text)-1});
$pad = ord($text[strlen($text)-1]);
if ($pad > strlen($text)) return $text;
if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return $text;
return substr($text, 0, -1 * $pad);
@ -1036,4 +1036,4 @@ function pkcs5_unpad($text){
function pkcs5_pad($text, $block = 8){
$pad = $block - (strlen($text) % $block);
return $text . str_repeat(chr($pad), $pad);
}
}