diff --git a/admin/tool/messageinbound/classes/manager.php b/admin/tool/messageinbound/classes/manager.php index 61152721af7..c42d87b462d 100644 --- a/admin/tool/messageinbound/classes/manager.php +++ b/admin/tool/messageinbound/classes/manager.php @@ -829,7 +829,7 @@ class manager { // An auto-reply may itself include the Bulk Precedence. $precedence = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('Precedence'); - $isbulk = $isbulk || strtolower($precedence) == 'bulk'; + $isbulk = $isbulk || strtolower($precedence ?? '') == 'bulk'; // If the X-Autoreply header is set, and not 'no', then this is an automatic reply. $autoreply = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('X-Autoreply'); diff --git a/lib/classes/message/inbound/address_manager.php b/lib/classes/message/inbound/address_manager.php index 1f4cb83be47..921d59af172 100644 --- a/lib/classes/message/inbound/address_manager.php +++ b/lib/classes/message/inbound/address_manager.php @@ -456,12 +456,27 @@ class address_manager { * @return string The encoded binary data */ protected function pack_int($int) { + // If PHP environment is running on a 64-bit. if (PHP_INT_SIZE === 8) { - $l = intdiv($int, pow(2, 32)); // 32-bit integer quotient. - $r = $int % pow(2, 32); // 32-bit integer remaining. + // Will be used to ensures that the result remains as a 32-bit unsigned integer and + // doesn't extend beyond 32 bits. + $notation = 0xffffffff; + if ($int < 0) { + // If the given integer is negative, set it to -1. + $l = -1; + } else { + // Otherwise, calculate the upper 32 bits of the 64-bit integer. + $l = ($int >> 32) & $notation; + } + + // Calculate the lower 32 bits of the 64-bit integer. + $r = $int & $notation; + + // Pack the values of $l (upper 32 bits) and $r (lower 32 bits) into a binary string format. return pack('NN', $l, $r); } else { + // Pack the values into a binary string format. return pack('NN', 0, $int); } } diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 900f9877a7f..0467ff5e3a8 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3308,5 +3308,12 @@ privatefiles,moodle|/user/files.php'; upgrade_main_savepoint(true, 2023042402.11); } + if ($oldversion < 2023042402.14) { + // Delete datakey with datavalue -1. + $DB->delete_records('messageinbound_datakeys', ['datavalue' => '-1']); + // Main savepoint reached. + upgrade_main_savepoint(true, 2023042402.14); + } + return true; } diff --git a/version.php b/version.php index 7d8d6abd4d7..42661a23066 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2023042402.13; // 20230424 = branching date YYYYMMDD - do not modify! +$version = 2023042402.14; // 20230424 = branching date YYYYMMDD - do not modify! // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.2.2+ (Build: 20231004)'; // Human-friendly version name