X-Cart:Payment methods not working in X-Cart 4.1.x

From X-Cart 4 Classic
Revision as of 14:18, 27 May 2016 by Aim (talk | contribs) (# If register_long_arrays = off (php5) is added)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

After upgrading to PHP 5.4 or later, users of X-Cart 4.1.x may experience a problem with their payment methods: after a buyer goes to complete their payment on the payment processor end, they are either not returned to the X-Cart store, or the order status in X-Cart remains "Not Finished" (not updated to "Processed") due to payment callback failure. (Note that X-Cart 4.2.x and later versions are not affected by this problem).

To fix the problem, you will need to add the following code snippet:

# If register_long_arrays = off (php5)
if (empty($HTTP_SERVER_VARS)) {
   $HTTP_GET_VARS = (array)$_GET;
   $HTTP_POST_VARS = (array)$_POST;
   $HTTP_POST_FILES = (array)$_FILES;
   $HTTP_ENV_VARS = (array)$_ENV;

to the beginning of payment method file for every payment method you will be using. For instance, for "PayPal Standard" you will need to add the above code snippet to payment/ps_paypal.php, for "AuthorizeNet - SIM" - to payment/cc_authorizenet_sim.php.