PHP Error when trying to open mail with empty message body (example PDF attachment from a Canon scanner)
Piler Version: 1.4.1 build 1001 on Ubuntu Linux 22.04.3 with nginx and php8.1
Fresh install.
2023/09/04 09:22:13 [error] 937#937: *833 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/piler/www/model/search/message.php:183
Stack trace:
#0 /var/piler/www/controller/message/view.php(83): ModelSearchMessage->extract_message()
#1 /var/piler/www/system/front.php(36): ControllerMessageView->index()
#2 /var/piler/www/system/front.php(14): Front->execute()
#3 /var/piler/www/index.php(114): Front->dispatch()
#4 {main}
thrown in /var/piler/www/model/search/message.php on line 183" while reading response header from upstream, client: 192.168.100.61, server: piler.baufeld.local, request: "POST /message.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "piler.baufeld.local", referrer: "http://xxx.yyy.zzz/search.php"
Possible fix in /var/piler/www/model/search/message.php line 183:
/* null check $parts */
if(!is_null($parts)) {
for($i=0; $i<count($parts); $i++) {
$body = Piler_Mime_Decode::fixMimeBodyPart($parts[$i]['headers'], $parts[$i]['body']);
if($parts[$i]['headers']['content-type']['type'] == 'text/html') {
$this->message['text/html'] .= $purifier->purify($body);
}
else {
$this->message['text/plain'] .= $body;
}
}
}
Comments (5)
-
repo owner -
reporter Will try V1.4.4 when my IMAP Imports are finished, and let you know.
-
reporter Upgraded to v1.4.4 (Web-UI health monitor showing 1.4.4 build 1001)
System is up and running, but the bug still exists in the Web-UI when trying to open an empty message with just an attachment file in it.
Added the if-Block from above to message.php again, then it is working.
-
repo owner It seems to happen when the message has no body at all. I’ve just fixed this issue on the master branch.
-
repo owner - changed status to closed
- Log in to comment
Please try https://bitbucket.org/jsuto/piler/downloads/piler-1.4.4.tar.gz