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

PHP 8.3 Uncaught TypeError: backend/imap/imap.php #44

Closed
dborg89 opened this issue Jan 11, 2024 · 2 comments
Closed

PHP 8.3 Uncaught TypeError: backend/imap/imap.php #44

dborg89 opened this issue Jan 11, 2024 · 2 comments

Comments

@dborg89
Copy link

dborg89 commented Jan 11, 2024

Server: nginx + php8.3-fpm

Behaviour:
When running z-push on php 8.3 I am getting fatal error from the imap backend causing it to kill the execution.

Log Data
2024/01/11 06:35:17 [error] 3293085#3293085: *5391 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, false given in /srv/z-push/backend/imap/imap.php:1132
Stack trace:
#0 /srv/z-push/backend/imap/imap.php(1132): implode()
#1 /srv/z-push/lib/default/diffbackend/exportchangesdiff.php(160): BackendIMAP->GetMessage()
#2 /srv/z-push/lib/request/sync.php(1199): ExportChangesDiff->Synchronize()
#3 /srv/z-push/lib/request/sync.php(956): Sync->syncFolder()
#4 /srv/z-push/lib/request/requestprocessor.php(116): Sync->Handle()
#5 /srv/z-push/index.php(107): RequestProcessor::HandleRequest()
#6 {main}
thrown in /srv/z-push/backend/imap/imap.php on line 1132" while reading response header from upstream, client: REDACTED, server: REDACTED, request: "POST /Microsoft-Server-ActiveSync/?Cmd=Sync&User=REDACTED&DeviceId=REDACTED&DeviceType=REDACTED HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.3-fpm.sock:", host: "REDACTED"

Code in question
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetMessage('%s', '%s', '%s')", $folderid, $id, implode(",", $bodypreference)));

Workaround
Reverting to php 7.4 at present to get around this.

Cause

Implode with historical parameter order
(https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.implode-reverse-parameters)
Passing parameters to implode() in reverse order is deprecated, use implode($glue, $parts) instead of implode($parts, $glue)

@matidau
Copy link
Collaborator

matidau commented Jan 11, 2024

Hi @dborg89

Can you use the the latest from the repo.

Believe this was already fixed in this commit bdbdd8f by @DoobleD

Cheers,
Mat

Edit: giving credit for the commit 😊

@matidau
Copy link
Collaborator

matidau commented Jan 11, 2024

Indeed this works!
Apologies for not noticing it in the commit history (just downloaded the latest stable from the releases section when I last updated).

Thanks :)

Originally posted by @dborg89 in #31 (comment)

Will close this off now 😊

@matidau matidau closed this as completed Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants