Skip to content

Commit

Permalink
Fix PHP fatal error when parsing some malformed BODYSTRUCTURE respons…
Browse files Browse the repository at this point in the history
…es (#9689)
  • Loading branch information
alecpl committed Nov 17, 2024
1 parent 2491c16 commit 00ef061
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
- Fix rcube_imap::get_vendor() result (and PHP warning) on Zimbra server (#9650)
- Fix regression causing inline SVG images to be missing in mail preview (#9644)
- Fix plugin "virtuser_file" to handle backward slashes in username (#9668)
- Fix PHP fatal error when parsing some malformed BODYSTRUCTURE responses (#9689)

## Release 1.6.9

Expand Down
4 changes: 2 additions & 2 deletions program/lib/Roundcube/rcube_imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,7 @@ protected function structure_part($part, $count = 0, $parent = '', $mime_headers
protected function is_attachment_part($part)
{
if (!empty($part[2]) && is_array($part[2]) && empty($part[3])) {
$params = array_map('strtolower', (array) $part[2]);
$params = array_map('strtolower', array_filter($part[2], 'is_string'));
$find = ['name', 'filename', 'name*', 'filename*', 'name*0', 'filename*0', 'name*0*', 'filename*0*'];

// In case of malformed header check disposition. E.g. some servers for
Expand All @@ -2304,7 +2304,7 @@ protected function is_attachment_part($part)
protected function structure_charset($structure)
{
while (is_array($structure)) {
if (is_array($structure[2]) && $structure[2][0] == 'charset') {
if (isset($structure[2]) && is_array($structure[2]) && $structure[2][0] == 'charset') {
return $structure[2][1];
}

Expand Down

0 comments on commit 00ef061

Please sign in to comment.