Why is the Craft without filter not working correctly and how to debug? I am using the Dukt Follow plugin to return 2 arrays which both hold User objects, I am then using the without filter to remove users from the array which are considered friends. Friends are determined by using the intersect filter on the 2 arrays.

Everything works apart from the second without filter which does not work, and returns objects that are in the friends array.

{# Friends, Followers &amp; Following #}
{% set userFollowing = craft.follow.getFollowing(user.id) %}
{% set userFollowers = craft.follow.getFollowers(user.id) %}

{% set friends = userFollowing|length and userFollowers|length ? userFollowing|intersect(userFollowers) : null %}
{% set following = userFollowing|without(friends) %}
{% set followers = userFollowers|without(friends) %}


Is there an obvious reason why this might not be working?
How is best to debug something like this?

I have checked the output of all the arrays and objects and they do appear to hold the data that they should. 

Basic data stored in each array:

User Following:
Array: ["Craft\\UserModel: bencallaway","Craft\\UserModel: davidwearn","Craft\\UserModel: shorn"]

User Followers:
Array: ["Craft\\UserModel: bencallaway","Craft\\UserModel: davidwearn"]

Friends:
Array: ["Craft\\UserModel: bencallaway","Craft\\UserModel: davidwearn"]

Following:
Array: {"2":"Craft\\UserModel: shorn"}

Followers:
Array: ["Craft\\UserModel: bencallaway","Craft\\UserModel: davidwearn"]


Full variable output can be accessed here: http://cl.ly/2o292X3O2r0M
Try using |without based on arrays of user IDs, not entire UserModel objects. Behind the scenes, it's just using PHP's in_array method, which works much better on simple primitives like ints, strings, etc. instead of complex objects like Models (that has magic methods, other objects, primitives, etc.).  in_array probably doesn't know how deep of a comparison to make on those objects.