HomeNicheWork Phabricator

Fix group expiration

Authored by Marijn van Wezel <marijnvanwezel@gmail.com> on Feb 3 2021, 10:34 AM.

Description

Fix group expiration

As you can see, the function does not return the correct result. The issue lies in the
"getExpirationFromPeriod" function, which is responsible for defining the expiry timestamp. This
function has two issues, the switch statement is missing "break" statements. This means that even if
"case self:ERIOD_MONTHLY" is matched, it will fall through to the next case and return an expiration
date of one year. More importantly, however, is that the switch-statement's input is not
correct. The "getPeriod" function used converts a string billing period ("monthly", "yearly") to a
billing period constant. However, in the input of the switch-statement "$this->billingPeriod" is
passed to "getPeriod", but "$this->billingPeriod" is already the billing period constant. Therefore,
"getPeriod" would return the fallback billing period constant "PERIOD_ONCE", which is not matched in
the switch-statement causing the default DateInterval of one second to be used.

Details

Committed
hexmodeFeb 3 2021, 10:39 AM
Pushed
hexmodeFeb 3 2021, 10:40 AM
Parents
R36:a058f7f4ea5e: Fix bugs I found this morning
Branches
Unknown
Tags
Unknown
References
HEAD -> master

Event Timeline

hexmode committed R36:e5790b2504d0: Fix group expiration (authored by Marijn van Wezel <marijnvanwezel@gmail.com>).Feb 3 2021, 10:39 AM