Payment problems in Magento Paypal Standard with IPN after upgrade from 1.3.x to 1.4.0.1

Those who, after a seemingly successful upgrade from Magento 1.3.x to Magento 1.4.0.1, have problems with Magento acknowledging PayPal payments (changing order status from Pending Payment to Processing) and sending out New Order emails to their clients should do/check the following things:

  1. In PayPal: Go to My Account -> Profiles -> More Options -> Instant Payment Notification Preferences -> Edit Settings and change instant payment notification (IPN) URL in PayPal IPN settings from:

    http://www.yoursite.com/paypal/standard/ipn/
    to:
    http://www.yoursite.com/paypal/ipn/standard/
  2. In Magento admin panel: Go to Systems -> Configuration -> Payment Methods -> PayPal Website Payments Standard and check that Payment Action is set to Sale and New Order status to Processing

  3. In Magento code: In file Ipn.php located in app/code/core/Mage/Paypal/Model/Ipn.php find function:

    public function getIpnFormData($key = null)

    comment out line:
    //return isset($this->_ipnFormData[$key]) ? $this>_ipnFormData[$key] : null;

    and add the following line immediately after it:
    return isset($this->_ipnFormData[$key]) ? urldecode($this->_ipnFormData[$key]) : null;

    This should do it. Your order status should be changing from Pending Payment to Processing and emails should work also.