From b5e76ab202900ca4e9581bd2101f480c40cde08d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 11 Jan 2020 09:21:36 +0100 Subject: [PATCH] Fix PHP Warning: array_filter() expects parameter 1 to be array, null given in subscription_options plugin (#7165) .. when IMAP connection fails --- CHANGELOG | 1 + .../subscriptions_option/subscriptions_option.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1312416db..cdb82567c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ CHANGELOG Roundcube Webmail - Password: Make chpass-wrapper.py Python 3 compatible (#7135) - Elastic: Fix bug where it was possible to switch editor mode when 'htmleditor' was in 'dont_override' (#7143) - Fix regression where "Open in new window" action didn't work (#7155) +- Fix PHP Warning: array_filter() expects parameter 1 to be array, null given in subscriptions_option plugin (#7165) RELEASE 1.4.2 ------------- diff --git a/plugins/subscriptions_option/subscriptions_option.php b/plugins/subscriptions_option/subscriptions_option.php index e9eaecc90..06e72e78a 100644 --- a/plugins/subscriptions_option/subscriptions_option.php +++ b/plugins/subscriptions_option/subscriptions_option.php @@ -79,13 +79,15 @@ class subscriptions_option extends rcube_plugin if (!$rcmail->config->get('use_subscriptions', true)) { $storage = $rcmail->get_storage(); - $folders = $storage->list_folders_direct(); - $folders = array_filter($folders, function($folder) use ($storage) { - $attrs = $storage->folder_attributes($folder); - return !in_array_nocase('\\Noselect', $attrs); - }); - $args['folders'] = $folders; + if ($folders = $storage->list_folders_direct()) { + $folders = array_filter($folders, function($folder) use ($storage) { + $attrs = $storage->folder_attributes($folder); + return !in_array_nocase('\\Noselect', $attrs); + }); + + $args['folders'] = $folders; + } } return $args;