Index: uc_credit.module =================================================================== --- uc_credit.module (revision 4830) +++ uc_credit.module (working copy) @@ -514,7 +514,11 @@ function uc_payment_method_credit($op, & $crypt = new uc_encryption_class; // Store the encrypted details in the session for the next pageload. - $_SESSION['sescrd'] = $crypt->encrypt($key, serialize($arg1->payment_details)); + // We are using base64_encode because the encrypt function works with a limited set of + // characters, not supporting unicode and other extended ASCII characters that are + // present on international names. base64 converts everything to the standard + // ascii alphabet. + $_SESSION['sescrd'] = $crypt->encrypt($key, base64_encode(serialize($arg1->payment_details))); // Log any errors to the watchdog. uc_store_encryption_errors($crypt, 'uc_credit'); @@ -1212,6 +1216,15 @@ function uc_credit_cache($op, $data = NU // Save the unencrypted CC details for the duration of this request. $cc_cache = unserialize($crypt->decrypt($key, $data)); + if ($cc_cache === FALSE) { + // In recent versions, we are base64_encoding the payment + // details before encrypting, but to be backward compatible between upgrades, + // and because after such an upgrade some of the data might have been stored + // w/o that encoding we first try to unserialize the encrypted data itself, + // if that fails, we assume it's the new format and we decode it before + // unserializing it. + $cc_cache = unserialize(base64_decode($crypt->decrypt($key, $data))); + } } else { $cc_cache = $data;