Skip to content

Commit

Permalink
Merge pull request #31 from DoobleD/develop
Browse files Browse the repository at this point in the history
Fix some PHP8 errors for IMAP backend
  • Loading branch information
matidau authored Oct 27, 2023
2 parents 0d65a74 + bdbdd8f commit 144ecb7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/backend/imap/imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ public function GetMessageList($folderid, $cutoffdate) {

if ($cutoffdate > 0) {
// IMAP SINCE search criteria
$searchCriteria = "SINCE ". date("d-M-Y", $cutoffdate);
$searchCriteria = "SINCE ". date("d-M-Y", (int) $cutoffdate);

// search messages in time range
$search = @imap_search($this->mbox, $searchCriteria);
Expand Down Expand Up @@ -1128,7 +1128,7 @@ public function GetMessageList($folderid, $cutoffdate) {
public function GetMessage($folderid, $id, $contentparameters) {
$truncsize = Utils::GetTruncSize($contentparameters->GetTruncation());
$mimesupport = $contentparameters->GetMimeSupport();
$bodypreference = $contentparameters->GetBodyPreference(); /* fmbiete's contribution r1528, ZP-320 */
$bodypreference = $contentparameters->GetBodyPreference() ?: []; /* fmbiete's contribution r1528, ZP-320 */
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetMessage('%s', '%s', '%s')", $folderid, $id, implode(",", $bodypreference)));

$folderImapid = $this->getImapIdFromFolderId($folderid);
Expand Down Expand Up @@ -1167,7 +1167,7 @@ public function GetMessage($folderid, $id, $contentparameters) {

// Detect Apple iOS devices
$isAppleIosDevice = false;
$deviceType = strtolower(Request::GetDeviceType());
$deviceType = strtolower(Request::GetDeviceType() ?? '');
if ($deviceType == 'iphone' || $deviceType == 'ipad' || $deviceType == 'ipod') {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetMessage():: iOS device %s->%s detected", Request::GetDeviceType(), Request::GetUserAgent()));
$isAppleIosDevice = true;
Expand Down Expand Up @@ -2505,6 +2505,9 @@ protected function parseAddr($ad) {
* @return
*/
protected function getModAndParentNames($fhir, &$displayname, &$parent) {
if (is_string($fhir)) {
$fhir = [$fhir];
}
// if mod is already set add the previous part to it as it might be a folder which has delimiter in its name
$displayname = (isset($displayname) && strlen($displayname) > 0) ? $displayname = array_pop($fhir) . $this->getServerDelimiter() . $displayname : array_pop($fhir);
$parent = implode($this->getServerDelimiter(), $fhir);
Expand Down

0 comments on commit 144ecb7

Please sign in to comment.