The release of introduces two programming errors in the wishlist observer: in order to make the method Mage_Wishlist_Model_Observer::processAddToCart compatible with PHP 7.2, the two usages of count on a possible NULL value are replaced by empty while it should have been !empty.

This is the diff between and of the file app/code/core/Mage/Wishlist/Model/Observer.php:

--- a/app/code/core/Mage/Wishlist/Model/Observer.php
+++ b/app/code/core/Mage/Wishlist/Model/Observer.php
@@ -102,7 +102,7 @@ class Mage_Wishlist_Model_Observer extends Mage_Core_Model_Abstract
             $wishlistIds = array($singleWishlistId);

-        if (count($wishlistIds) && $request->getParam('wishlist_next')){
+        if (empty($wishlistIds) && $request->getParam('wishlist_next')){
             $wishlistId = array_shift($wishlistIds);

             if (Mage::getSingleton('customer/session')->isLoggedIn()) {
@@ -125,7 +125,7 @@ class Mage_Wishlist_Model_Observer extends Mage_Core_Model_Abstract

-        if ($request->getParam('wishlist_next') && count($urls)) {
+        if ($request->getParam('wishlist_next') && empty($urls)) {
             $url = array_shift($urls);
             $message = array_shift($messages);

the impact of this error is not clear to me: on the one hand the bodies of the if statements are executed exactly in wrong circumstances resulting in wishlist items not being deleted, incorrect/missing error messages in the session and redirects to NULL. But on the other hand, this logic is only triggered when the wishlist_next query parameter has a truthy value. However, I cannot find any place where wishlist_next query parameter is set.

So my question is: what is the real impact of these programming errors?

  • 1
    Wow, correct about empty() vs count() usage, and I too cannot find anywhere in the code where wishlist_next is set or setWishlistNext() is called.
    – benmarks
    Commented Dec 11, 2018 at 11:24
  • Found it, wishlist_next was in use until CE, and has been removed in CE Commented Dec 11, 2018 at 13:15

1 Answer 1


There is no real impact: the wishlist_next parameter was in use until CE and has been removed in CE

Its use seemed to be an error handling feature whenever an exception was thrown while trying to move an item from a wishlist (the user's own wishlist or a shared wishlist) to the cart. I suspect this was made for the case when a wishlist item was not completely configured: instead of adding the item to the cart, the user is redirected to the product view page to which the query parameter wishlist_next = 1 is added; when the configuration is finished and the product is added to the cart, the wishlist_next parameter is passed to the addtocart url, where it was supposed to remove the original item from the wishlist.

Methods in which this functionality was present (with links to CE

Note that there is a small impact when calling a product url with wishlist_next = 1: the item will be added to the cart, but instead of a success message an error message appears stating that the item could not be added to the cart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.