From 0edbdab1d8cc8796cebaab1b22cd3f67e3fd5bdd Mon Sep 17 00:00:00 2001 From: kjh Date: Tue, 24 May 2022 08:44:52 +0000 Subject: [PATCH] PHP8.1 Syntax/Functionality Changes & Deprecations List Check --- lib/PHPExcel/Calculation/DateTime.php | 8 ++++---- plugin/PHPMailer/extras/ntlm_sasl_client.php | 2 +- plugin/kcaptcha/kcaptcha.lib.php | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/PHPExcel/Calculation/DateTime.php b/lib/PHPExcel/Calculation/DateTime.php index 72f4c7a23..76d471b29 100644 --- a/lib/PHPExcel/Calculation/DateTime.php +++ b/lib/PHPExcel/Calculation/DateTime.php @@ -534,7 +534,7 @@ class PHPExcel_Calculation_DateTime if ($testVal2 !== false) { $testVal3 = strtok('- '); if ($testVal3 === false) { - $testVal3 = strftime('%Y'); + $testVal3 = date('Y'); } } else { return PHPExcel_Calculation_Functions::VALUE(); @@ -554,16 +554,16 @@ class PHPExcel_Calculation_DateTime if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) { // Execute function if ($PHPDateArray['year'] == '') { - $PHPDateArray['year'] = strftime('%Y'); + $PHPDateArray['year'] = date('Y'); } if ($PHPDateArray['year'] < 1900) { return PHPExcel_Calculation_Functions::VALUE(); } if ($PHPDateArray['month'] == '') { - $PHPDateArray['month'] = strftime('%m'); + $PHPDateArray['month'] = date('m'); } if ($PHPDateArray['day'] == '') { - $PHPDateArray['day'] = strftime('%d'); + $PHPDateArray['day'] = date('d'); } $excelDateValue = floor( PHPExcel_Shared_Date::FormattedPHPToExcel( diff --git a/plugin/PHPMailer/extras/ntlm_sasl_client.php b/plugin/PHPMailer/extras/ntlm_sasl_client.php index 3fd539240..f412ef006 100644 --- a/plugin/PHPMailer/extras/ntlm_sasl_client.php +++ b/plugin/PHPMailer/extras/ntlm_sasl_client.php @@ -66,7 +66,7 @@ class ntlm_sasl_client_class public function NTLMResponse($challenge, $password) { $unicode = $this->ASCIIToUnicode($password); - $md4 = mhash(MHASH_MD4, $unicode); + $md4 = hash('md4', $unicode, true); $padded = $md4 . str_repeat(chr(0), 21 - strlen($md4)); $iv_size = mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); diff --git a/plugin/kcaptcha/kcaptcha.lib.php b/plugin/kcaptcha/kcaptcha.lib.php index 6354399b9..3da6a84d4 100644 --- a/plugin/kcaptcha/kcaptcha.lib.php +++ b/plugin/kcaptcha/kcaptcha.lib.php @@ -171,10 +171,10 @@ class KCAPTCHA{ if($sx<0 || $sy<0 || $sx>=$width-1 || $sy>=$height-1){ continue; }else{ - $color=imagecolorat($img, $sx, $sy) & 0xFF; - $color_x=imagecolorat($img, $sx+1, $sy) & 0xFF; - $color_y=imagecolorat($img, $sx, $sy+1) & 0xFF; - $color_xy=imagecolorat($img, $sx+1, $sy+1) & 0xFF; + $color=imagecolorat($img, (int)$sx, (int)$sy) & 0xFF; + $color_x=imagecolorat($img, (int)$sx+1, (int)$sy) & 0xFF; + $color_y=imagecolorat($img, (int)$sx, (int)$sy+1) & 0xFF; + $color_xy=imagecolorat($img, (int)$sx+1, (int)$sy+1) & 0xFF; } if($color==255 && $color_x==255 && $color_y==255 && $color_xy==255){ @@ -204,7 +204,7 @@ class KCAPTCHA{ $newblue=$newcolor0*$foreground_color[2]+$newcolor*$background_color[2]; } - imagesetpixel($img2, $x, $y, imagecolorallocate($img2, $newred, $newgreen, $newblue)); + imagesetpixel($img2, (int)$x, (int)$y, imagecolorallocate($img2, (int)$newred, (int)$newgreen, (int)$newblue)); } }