Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some PHP8 errors for IMAP backend #31

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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