[dev] Silence warnings in Courier quota subclass

John Morrissey jwm at horde.net
Tue Mar 25 11:55:12 PST 2003


PHP generates undefined index warnings if the Courier IMAP server can't
retrieve a user's quota information. The attached patch silences them.

john
-- 
John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__
-------------- next part --------------
Index: imp/lib/Quota/courier.php
===================================================================
RCS file: /repository/imp/lib/Quota/courier.php,v
retrieving revision 1.10
diff -u -r1.10 courier.php
--- imp/lib/Quota/courier.php	3 Jan 2003 23:31:34 -0000	1.10
+++ imp/lib/Quota/courier.php	25 Mar 2003 16:54:50 -0000
@@ -31,9 +31,9 @@
             $quota = @imap_get_quota($stream, 'ROOT');
             @imap_close($stream);
             if (is_array($quota)) {
-                if ($quota['limit'] != 0) {
+                if (!empty($quota['limit'])) {
                     return $this->_quotaHTML($quota['usage'] * 1024, $quota['limit'] * 1024);
-                } elseif ($quota['STORAGE']['limit'] != 0) {
+                } elseif (!empty($quota['STORAGE']['limit'])) {
                     return $this->_quotaHTML($quota['STORAGE']['usage'] * 1024, $quota['STORAGE']['limit'] * 1024);
                 }
             }


More information about the dev mailing list