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

1.3.7 rcube_imap_generic::getQuota array_chunk() expects parameter 1 to be array, null given #6374

Closed
seveN864 opened this issue Aug 4, 2018 · 4 comments
Milestone

Comments

@seveN864
Copy link

seveN864 commented Aug 4, 2018

RC 1.3.7 improvement

Warning messages:
PHP message: PHP Warning: array_chunk() expects parameter 1 to be array, null given in /var/www/(REMOVED)/program/lib/Roundcube/rcube_imap_generic.php on line 3129
PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/(REMOVED)/program/lib/Roundcube/rcube_imap_generic.php on line 3129

thrown when "no" quotas set:

 C: a3 GETQUOTAROOT INBOX
 S: * QUOTAROOT "INBOX" "ROOT"
 S: * QUOTA "ROOT"
 S: a3 OK GETQUOTAROOT Ok.

quick fix check if $quotas is empty:

--- roundcubemail-1.3.7/program/lib/Roundcube/rcube_imap_generic.php    2018-07-29 22:04:48.000000000 +0200
+++ program/lib/Roundcube/rcube_imap_generic.php        2018-08-04 13:06:22.138743417 +0200
@@ -3126,6 +3126,9 @@
                     list(, , $quota_root) = $this->tokenizeResponse($line, 3);
 
                     $quotas = $this->tokenizeResponse($line, 1);
+                   if(empty($quotas)) { 
+                       continue;
+                   }
                     foreach (array_chunk($quotas, 3) as $quota) {
                         list($type, $used, $total) = $quota;
                         $type = strtolower($type);


@alecpl
Copy link
Member

alecpl commented Aug 4, 2018

We'll apply this fix, but what IMAP server? This looks like not compatible with RFC2087.

@alecpl alecpl added this to the 1.3.8 milestone Aug 4, 2018
@seveN864
Copy link
Author

seveN864 commented Aug 4, 2018

Thank you. IMAP server is Courier-IMAP 4.17.1

Output with active quota (for demonstration):

C: a2 GETQUOTAROOT inbox
S: * QUOTAROOT "inbox" "ROOT"
S: * QUOTA "ROOT" (STORAGE 19864 195313)
S: a2 OK GETQUOTAROOT Ok.

works as expected with roundcube.

Good point regarding RFC2087 ( https://tools.ietf.org/rfc/rfc2087.txt )
Refering to "5.2. QUOTAROOT Response":

(...)
Resources not named in the list are not limited in the quota root.
Thus, an empty list means there are no administrative resource
limits in the quota root.
(...)

The response seems to be valid for a unlimited IMAP account to me. YMMV
Also take a look at the example "5.2. QUOTAROOT Response".

@alecpl
Copy link
Member

alecpl commented Aug 5, 2018

Imo, a valid response would be * QUOTA "ROOT" (), because quota_list is not optional according to the Formal Syntax. I think most servers just skip that line.

@alecpl
Copy link
Member

alecpl commented Aug 6, 2018

Fixed.

@alecpl alecpl closed this as completed Aug 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants