[bugs] [Bug 1033] Changed - Quota bug report NO LIMIT when no messages in INBOX

bugs@bugs.horde.org bugs@bugs.horde.org
Mon Oct 14 16:11:52 2002


http://bugs.horde.org/show_bug.cgi?id=1033

*** shadow/1033	Sat Oct 12 05:01:13 2002
--- shadow/1033.tmp.6544	Mon Oct 14 12:11:52 2002
***************
*** 93,95 ****
--- 93,137 ----
  on this but I think it's more a fault with the mail server no returning zero usage.
  
  - Mike :-)
+ 
+ ------- Additional Comments From kevin_myer@iu13.org  10/14/02 12:11 -------
+ I think I might have muddied this problem with my description.  In my testing
+ and with my patch, all four of the components you have in your matrix work.  The
+ problem I'm really after is not in distinguishing between a user without a quota
+ and a non-existent user (although they both return the same value for
+ imap_get_quota, it doesn't matter because if you are calling imap_get_quota, you
+ can safely assume the user exists).
+ 
+ The problem is with the way the current code treats a zero value and a
+ non-existant value.  As I stated in my original report, "!empty($used)" returns
+ false in both cases (which is it does because that exactly what the PHP
+ documentation does).  If you use "isset($used)" it returns false for no quota
+ but true (with $used=0) for a user with a quota but with no mail.
+ 
+ I'm just not seeing how my patch breaks anything.  Rather, I think it fixes the
+ case where a quota is set but no mail exists.
+ 
+ Its not a mail server issue - its a php function choice issue for testing what
+ the mail server returns and your function choice treats both "0" (zero) and
+ non-existant the same, where what you really need to be doing is checking to see
+ if the variable $used has a value set.
+ 
+ Bottom line:  if you use "isset($used)" instead of "!empty($used)", you can tell
+ the difference between a mailbox with a quota but no mail and a mailbox without
+ a quota, because they treat a value of "zero" differently.
+ 
+ Example:
+ 
+ user is dummy_user
+ 
+ if quota is set but usage is zero OR if no quota is set, with the current code:
+ 
+ inside _quotaHTML,
+ if (!empty($used) && !empty($total)) will return NO_LIMIT
+ 
+ With my patch:
+ if (isset($used) && !empty($total)) will return 0/LIMIT if no messages but a
+ quota is set and will return NO_LIMIT if no quota is set.
+ 
+ I'd like to reopen this but I'll let you make that call.  I'd especially welcome
+ examples of how my patch breaks the return value of the quota portion of IMP.