php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14673 quota ressources
Submitted: 2001-12-23 11:33 UTC Modified: 2002-07-26 12:23 UTC
Votes:6
Avg. Score:4.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:2 (50.0%)
From: kaalh at smol dot org Assigned: kalowsky (profile)
Status: Closed Package: IMAP related
PHP Version: 4.1.0 OS: Debian Woody i386
Private report: No CVE-ID: None
 [2001-12-23 11:33 UTC] kaalh at smol dot org
imap_get_quota() return only an array with the last quota resource usage & limit.

An IMAP4 server which supports the QUOTA capability may support limits on any number of resources (rfc2087)

Maybe it should return all resources usages & limits in an associative array.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-28 16:48 UTC] llima at imagelink dot com dot br
I have the same problem. I'm not an experienced programmer so I could not come with a patch. However, I've experienced it first hand.

The IMAP server we use replies with (STORAGE aa bb TRIGGER cc dd), where TRIGGER is a value em bytes that triggers the server to send a warning to the user.

PHP4 is considering the usage to be cc and the quota dd, just like described by kaalh@smol.org. Looks like it really gets the last two numbers it finds and uses them.
 [2002-06-11 05:54 UTC] tmlfung at yahoo dot com dot hk
My imap server(InterMail server) returns:

0 getquota ""
* QUOTA "" (STORAGE 250 10000 MESSAGE 26 1500)
0 OK GETQUOTA completed

imap_get_quota is unable to return the STORAGE value.
 [2002-07-06 11:27 UTC] php at tcs dot eng dot br
It appears to me that the error is on the IMAP library:

php_imap.c:1031:if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) {

imap_getquota() is implemented by the IMAP library.  I'll try and see if I can find the error on the library and then post a patch.
 [2002-07-06 15:09 UTC] php at tcs dot eng dot br
My bad.  The problem is really on php_imap.c, as noted by kaalh@smol.org.
I have produced a patch to "fix" the behavior reported by llima@imagelink.com.br.  I can't produce a patch to report all the resources as kaalh@smol.org suggested because that would break the compatibility :-/.

Anyway, here's the (small) patch:

--- php_imap.c  Wed Apr 24 12:30:16 2002
+++ php_imap_fixed.c    Sat Jul  6 15:47:55 2002
@@ -374,8 +374,12 @@
        /* this should only be run through once */
        for (; qlist; qlist = qlist->next)
        {
-               IMAPG(quota_usage) = qlist->usage;
-               IMAPG(quota_limit) = qlist->limit;
+    if (!strcmp(qlist->name, "STORAGE"))
+    {
+      IMAPG(quota_usage) = qlist->usage;
+      IMAPG(quota_limit) = qlist->limit;
+      break;
+    }
        }
 }
 /* }}} */

Suggestions or comments, please mail me.  I haven't tested the patch yet, BTW!!  But my good friend is testing it for me and I'll ask him to post the results here. :)
 [2002-07-06 16:34 UTC] llima at imagelink dot com dot br
The patch does work. Actually, it works exactly as advertised. Now imap_get_quota() gets only the value returned by the STORAGE resource and ignores the rest.
 [2002-07-06 18:55 UTC] sniper@php.net
Assigning to Dan, as he was working on with some other
quota stuf.

 [2002-07-22 00:25 UTC] kalowsky@php.net
I love you sniper. :)

To all those finding this problem, please look at the PHP-Dev mailing lists and try applying the patch I sent out July 18th 2002 to your PHP 4.2.1

It will not fix all the problems you are listing, it will implement imap_get_quotaroot, and adds functionality to imap_getquota for the name of where it gets it's data.  If this works well enough for everyone I can easily implement a fix for the symptoms mentioned below.   Do please test.
 [2002-07-26 12:23 UTC] kalowsky@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

try it and see
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 09 10:01:27 2024 UTC