Fixed encoding issue in paypal IPN callback
authorMarcel Werk <burntime@woltlab.com>
Wed, 15 Jul 2015 15:42:11 +0000 (17:42 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 15 Jul 2015 15:42:11 +0000 (17:42 +0200)
wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php

index b766a9c912f2ed704938854bdaf7fd210dd8d6e3..f570a71ba82925f1334fb362274bcd923a31586f 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\object\type\ObjectTypeCache;
 use wcf\system\exception\SystemException;
 use wcf\system\payment\type\IPaymentType;
 use wcf\util\HTTPRequest;
+use wcf\util\StringUtil;
 
 /**
  * Handles Paypal callbacks.
@@ -48,6 +49,13 @@ class PaypalCallbackAction extends AbstractAction {
                                throw new SystemException('request not validated');
                        }
                        
+                       // fix encoding
+                       if (!empty($_POST['charset']) && strtoupper($_POST['charset']) != 'UTF-8') {
+                               foreach ($_POST as &$value) {
+                                       $value = StringUtil::convertEncoding(strtoupper($_POST['charset']), 'UTF-8', $value);
+                               }
+                       }
+                       
                        // Check that receiver_email is your Primary PayPal email
                        if (strtolower($_POST['business']) != strtolower(PAYPAL_EMAIL_ADDRESS) && (strtolower($_POST['receiver_email']) != strtolower(PAYPAL_EMAIL_ADDRESS))) {
                                throw new SystemException('invalid business or receiver_email');