#250 check_quota function fails to handle unlimited quota

Core (82)

(found in SVN 1061)

When a domain's quota is set to "0", meaning "unlimited quota" according to the web interface, all edits to a user's quota are rejected as too high.

The problem is in the function "check_quota", which checks

if ($quota > $limit['maxquota'])
$rval = false;

AFTER it checks

if ($limit['maxquota'] == 0)
$rval = true;

and therefore declines any quota for being greater than the "maximum" of 0. Reversing these two checks fixes the problem and causes a quota of 0 to return a successful quota_check as expected.


  • Christian Boltz

    Christian Boltz - 2011-05-31
    • status: open --> closed-fixed
  • Christian Boltz

    Christian Boltz - 2011-05-31

    I prefer code that does not depend on the execution order too much ;-)

    check_quota() was more or less rewritten to support domain-level total quota. On the positive side this means that 2.3.x is not affected by this bug.

    I just changed some parts of the function back to the 2.3.x state - it now uses "return true/false" again instead of settiong $rval if the result is final (as in "can't be changed by domain quota check"). I also added several comments that explain what the function is doing after it took me a while to understand it ;-)

    The bug you reported is fixed by this change:

    - if ($quota > $limit['maxquota']) {
    + if ($limit['maxquota'] != 0 && $quota > $limit['maxquota']) {

    This excludes the "unlimited" maxquota from the check and should therefore solve the problem.

    Commited to SVN trunk r1065. Thanks for the bugreport!


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks