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.

Comments

torotil’s picture

Status: Active » Needs review
StatusFileSize
new717 bytes

Here is a patch that implements the proposed solution.

xano’s picture

I 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?

torotil’s picture

Yes 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.

xano’s picture

StatusFileSize
new682 bytes
new548 bytes

Why 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.

xano’s picture

StatusFileSize
new516 bytes

Re-roll.

  • Xano committed 8388935 on 7.x-1.x authored by torotil
    Issue #2352739 by Xano, torotil: Fixed Reset static caches on module...
xano’s picture

Status: Needs review » Fixed

@torotil: Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.