WPSC_Cart is not traversable
https://github.com/wp-e-commerce/WP-e-Commerce/commit/a9009d016523074141211eb83dfd75bef865f36a introduced a loop that iterates over WPSC_Cart, which is not techncially traversable.
I don't fully understand what the intent of the commit is here. As such, I'm not clear if we should be iterating over the public properties of the object, or implement Iterator - or something else. Would welcome thoughts here from @JeffPyeBrook
From what I can tell, reviewing that commit, the iteration over the WPSC_Cart object was not introduced in that commit, but simply moved around. Digging in to find the genesis of that loop.
Looks like https://github.com/wp-e-commerce/WP-e-Commerce/commit/92d57ac is likely the culprit, as it introduces looping the wpsc_cart object.
@JeffPyeBrook Make sense? We can either implement an iterator, or loop over get_object_vars() - so long as that's the intent here
@JustinSainton Trying to remember the genesis of that loop. I do recall that there were two WordPress defects that drove the need to do that somewhat wacky construction/deconstruction. One of these defects was a fatal recursion issue.
Not debating if it is a good idea or not, but in PHP you could for loop over object properties. Under the hood I believe PHP does the quivelant of a cast to an array and then does the loop. Not sure I remember why the for loop was used in place of get_object_vars, but I suspect there was a reason or I would have done it with get_object_vars. It's a function I know, and use often.
I also remember thinking that when the cart class was refactored that the logic here would be replaced by accessing the refactored cart class' serialization/deserialization interface.