The payment module makes use of several statically cached variables. Currently it doesn't ever invalidate the caches.
This leads to some unexpected behavior:
$controller1 = payment_method_controller_load_multiple(array('controller1'));
// payment_method_controllers_info() is now cached in drupal static.
module_enable(array('payment2_payment'));
$controller2 = payment_method_controller_load_multiple(array('controller2'));
// $controller2 is a PaymentMethodControllerUnavailable object.
One case where this matters is installation profiles that create payment methods. The first payment method usually will succeed - the second may not.
Proposed solution: flush static caches on module enable/disable.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | payment_2352739_5.patch | 516 bytes | xano |
Comments
Comment #1
torotil commentedHere is a patch that implements the proposed solution.
Comment #2
xanoI wonder if we could/should fix this in core instead. Currently only the module administration form flushes all persistent caches when it is submitted, but this should actually just happen in the
module_*()functions. What do you think?Comment #3
torotil commentedYes I totally agree. I've always wondered why drupal core doesn't flush all static caches by default. I guess the chances to get this in D7 in a reasonable time are rather small though.
Comment #4
xanoWhy don't we just wipe all static caches? It should be done anyway, and if core doesn't do it, it might as well be Payment.
Comment #5
xanoRe-roll.
Comment #7
xano@torotil: Thanks!