Hello,

Site receives IPN then code do validate IPN, with command 'cmd=_notify-validate', and if account has umlaut in first or last name it always return INVALID and processing of order stops. How fix it? Any idea?

Example IPN

IPN
(
    [mc_gross] => 28.95
    [invoice] => 1356998-EXAMPLE_INVOICE
    [protection_eligibility] => Eligible
    [item_number1] => 
    [payer_id] => XXXXXXXXXXX
    [tax] => 0.00
    [payment_date] => 10:02:49 Apr 27, 2018 PDT
    [option_selection1_1] => 1
    [payment_status] => Completed
    [charset] => windows-1252
    [mc_handling] => 0.00
    [first_name] => Artem
    [mc_fee] => 1.39
    [notify_version] => 3.9
    [custom] => 
    [payer_status] => verified
    [business] => example@invoice.com
    [num_cart_items] => 1
    [verify_sign] => XXXXXXXXXXXXXXXXXXXXXX
    [payer_email] => payer_email@gmx.ch
    [option_name1_1] => Product count
    [txn_id] => XXXXXXXXXXXXXXXXXXXXXX
    [payment_type] => instant
    [last_name] => Märli
    [item_name1] => Order 1356998 at SITENAME
    [receiver_email] => example@invoice.com
    [payment_fee] => 
    [quantity1] => 1
    [receiver_id] => XXXXXXXXXXXXXXX
    [txn_type] => cart
    [mc_gross_1] => 28.95
    [mc_currency] => EUR
    [residence_country] => CH
    [transaction_subject] => 
    [payment_gross] => 
    [ipn_track_id] => XXXXXXX
)

Comments

mar4ehk0 created an issue. See original summary.

tr’s picture

Issue tags: -payment paypal

I think the problem is the following lines in uc_paypal.pages.inc:

  foreach ($_POST as $key => $value) {
    $post_fields[] = $key . '=' . urlencode(stripslashes($value));
  }

PayPal used to allow only ASCII characters, but now it allows UTF-8 for almost everything. These lines of code HTML-encode the strings in the IPN to sanitize them and ensure that they are valid ASCII, but that no longer needs to be done.

Can you change this to the following and see if this fixes the issue?

  foreach ($_POST as $key => $value) {
    $post_fields[] = $key . '=' . $value;
  }

If this fixes the issue for you, I will review the code to make sure this removal of the sanitization doesn't cause a security issue, then I will post a proper patch.

mar4ehk0’s picture

I changed, but it still creates problem

      if (!($key == 'first_name' || $key == 'last_name')) {
        $value = urlencode(stripslashes($value));
      }
      $request .= $key . '=' . $value . '&';

I exclude first_name and last_name that its have umlaut

tr’s picture

I don't understand what you did - did you try the change in #2 or did you try your own change? Please use #2.

I don't know what your code in #3 is supposed to do - we don't use a $request variable in uc_paypal.pages.inc.

mar4ehk0’s picture

I used old version of module. And I fixed it, need change charset to UTF-8, more

tr’s picture

Thanks for that link.

I understand that this is solved by a configuration setting on your PayPal account, correct?

And there is nothing that needs to be changed in Ubercart, correct?

mar4ehk0’s picture

Problem was on PayPal account, and not change anything, you can close it.

tr’s picture

Status: Active » Closed (works as designed)

Thank you.