If the nid of a non-existent product is passed to uc_product_get_picture(), a PHP "trying to get property of non-object" notice is generated at line 1784 (the program is trying to access a $node->type. This is also a problem for the upgrade of uc_coupon, because we insert a non-product in the cart with a nid=0 in order to show the coupon on the cart display page.

The attached patch checks for a valid $node and returns an empty array before proceeding. The behavior is exactly the same, but the notice is suppressed.

CommentFileSizeAuthor
uc_product-get-picture-check.patch487 byteswodenx

Comments

tr’s picture

Status: Active » Needs review
longwave’s picture

Status: Needs review » Fixed

Committed, thanks for the patch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.