Zen Cart Logo
Forums / Bug Reports / PayPal Express Checkout: Warning generated if country not supported

PayPal Express Checkout: Warning generated if country not supported

Views: 958

Results 1 to 2 of 2
17 Apr 2015, 10:28 AM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

PayPal Express Checkout: Warning generated if country not supported

If the customer uses PayPal Express Checkout and the country they specify is not supported by the store (e.g. the country is disabled or deleted), a PHP warning is issued:

[16-Apr-2015 13:14:57 Australia/Victoria] #1 array_merge() called at [/home/xxxx/public_html/yyyy/includes/modules/payment/paypalwpp.php:2320]
#2 paypalwpp->findMatchingAddressBookEntry() called at [/home/xxx/public_html/yyyy/includes/modules/payment/paypalwpp.php:1905]
#3 paypalwpp->ec_step2_finish() called at [/home/xxx/public_html/yyyy/includes/modules/payment/paypalwpp.php:1759]
#4 paypalwpp->ec_step2() called at [/home/xxx/public_html/yyyy/ipn_main_handler.php:80]

[16-Apr-2015 13:14:57 Australia/Victoria] PHP Warning: array_merge(): Argument #1 is not an array in /home/xxx/public_html/yyyy/includes/modules/payment/paypalwpp.php on line 2320

Line 2320:

    $this->zcLog('findMatchingAddressBookEntry - 1-stats', 'lookups:' . "\n" . print_r(array_merge($country->fields, array('zone_country_id' => $country_zone_check->fields['zone_id']), $logMsg), true) . "\n" . 'check_zone: ' . $check_zone . "\n" . 'zone:' . $zone_id . "\nSubmittedAddress:".print_r($address_question_arr, TRUE));

The warning is being thrown because the first argument ($country->fields) is not an array since the country is not supported. I suggest correcting this by the following change:

    [B]$country_array = ($country->EOF) ? array () ? $country->fields;[/B]
    $this->zcLog('findMatchingAddressBookEntry - 1-stats', 'lookups:' . "\n" . print_r(array_merge([B]$country_array[/B], array('zone_country_id' => $country_zone_check->fields['zone_id']), $logMsg), true) . "\n" . 'check_zone: ' . $check_zone . "\n" . 'zone:' . $zone_id . "\nSubmittedAddress:".print_r($address_question_arr, TRUE));
17 Apr 2015, 10:38 AM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

Re: PayPal Express Checkout: Warning generated if country not supported

Update: The store has deleted all unsupported countries from the countries table.