easy-digital-downloads icon indicating copy to clipboard operation
easy-digital-downloads copied to clipboard

3.0 - Undefined notices on view order page when a customer is not attached to the order

Open mihaijoldis opened this issue 2 years ago • 1 comments

Bug Report

Expected behavior

No error notices to show. Ever.

Actual behavior

Viewing an order that does not have a customer attached shows them in the debug.log file

Steps to reproduce the behavior

  1. Open an order in the admin that does not have a customer attached.
  2. I believe the only way this would occur is if the Customer record that was linked to that order is removed.

Information (if a specific version is affected):

PHP Version: 7.4

EDD Version (or branch): release/3.0

WordPress Version: latest

Any other relevant information:

[13-May-2022 15:35:34 UTC] PHP Notice:  Trying to get property 'email' of non-object in /Users/mishu/Desktop/Mamp-Htdocs/edd30/wp-content/plugins/easy-digital-downloads/includes/admin/payments/orders.php on line 308
[13-May-2022 15:35:34 UTC] PHP Notice:  Trying to get property 'emails' of non-object in /Users/mishu/Desktop/Mamp-Htdocs/edd30/wp-content/plugins/easy-digital-downloads/includes/admin/payments/orders.php on line 310
[13-May-2022 15:35:34 UTC] PHP Warning:  Invalid argument supplied for foreach() in /Users/mishu/Desktop/Mamp-Htdocs/edd30/wp-content/plugins/easy-digital-downloads/includes/admin/payments/orders.php on line 310

mihaijoldis avatar May 13 '22 15:05 mihaijoldis

I think we should simply check if the Customer does exist here https://github.com/awesomemotive/easy-digital-downloads/blob/release/3.0/includes/admin/payments/orders.php#L307

mihaijoldis avatar May 13 '22 15:05 mihaijoldis