1 reply [Last post]
incaic's picture
Offline
Joined: 10/13/2007
Juice: 115
Was this information Helpful?

I noticed a bug in _payment_gateway_list on Alpha 7e and it seems to be fixed in 8, but the fix is done by manipulating the result of the function instead of the function itself.

Problem: using unset on an array with numeric keys does not reindex the array

uc_payment.module line 1111

<?php
 
unset($gateways[$i]);
?>

Fix: using array_splice does reindex the array

<?php
  array_splice
($gateways,$i,1);
?>

The fix in Alpha 8 was placed in uc_payment_process lines 900 - 902 and uses array_keys to overcome the problem. To prevent any other potential problems with the results of _payment_gateway_list, it might be best to fix it there at the root of the problem.

Any thoughts?

incaic's picture
Offline
Joined: 10/13/2007
Juice: 115
Re: _payment_gateway_list bug

Code snippet is from Alpha 8