[imp] Bug in Quota Mechanism for Cyrus IMAP and PHP 4.2.X and lower

Roel Gloudemans roel at gloudemans.info
Sat Dec 13 08:34:24 PST 2003


Hi,

There is a bug in the determination of the quota of a mailbox. When using Cyrus
IMAP and PHP 4.2.X or lower, it says "Unable to determine Quota".

The bug is located in imp/lib/Quota/cyrus.php

The following code is used to determine the quota
if (function_exists('imap_get_quotaroot')) {
  @$quota = imap_get_quotaroot($_SESSION['imp']['stream'], 'INBOX');
} else {
  $stream = @imap_open(IMP::serverString(), $this->_params['login'],
this->_params['password'], OP_HALFOPEN);
  if ($stream !== false) {
    $quota = @imap_get_quota($stream, 'INBOX');
    @imap_close($stream);
  }
}

PHP 4.3.X and higher use the function imap_get_quotaroot, PHP 4.2.X use
imap_get_quota, however the syntaxis for this function is incorrect. It should
be something like (I use / as the mailbox separator not ., so the syntax below
works for me):
$quota = @imap_get_quota($stream, 'user/'.$_SESSION['imp']['user']);

Cheers,
Roel.



More information about the imp mailing list