Search code examples
magentomagento-1.5

Magento Bug In Mage_Paypal_Model_Ipn


I am using Magento Community 1.5.0.1 and when I receive a PayPal IPN message to /paypal/ipn, the transaction information in coming in successfully, and the order is automatically moved to paid and a invoice is generated.

However, in my PHP logs I get this message: [28-Jul-2011 06:42:36] PHP Fatal error: Call to a member function getIncrementId() on a non-object in /app/code/core/Mage/Paypal/Model/Ipn.php on line 390 [28-Jul-2011 06:42:36] PHP Fatal error: Class 'Mage' not found in /app/code/core/Mage/Core/Model/Mysql4/Session.php on line 0

Also, a email is sent to our admin email (since I have it enabled to have invoices sent to us), however, a email is not sent to the customer.

I imagine these are related.

Any ideas on how to fix this? It makes no sense for a error to be returned since when I echo $creditmemo->getIncrementId(); just before the line causing the error, the ID is clearly being returned!

This is bad because as a fatal error, it


Solution

  • Obviously it is not a good idea to modify core files, but see if it works by changing the following line:

    if ($invoice = $payment->getCreatedInvoice() && !$this->_order->getEmailSent()) {
    

    to the following:

    if (($invoice = $payment->getCreatedInvoice()) && !$this->_order->getEmailSent()) {