The base comparator method currently breaks if you pass an associative array containing a node, because for some reason we can't directly compare arrays, AAs or nodes.
With the following changes, the base comparator will return an early false if it sees that both values have different types, and it will also compare node types using the isSameNode method available on nodes.
Some changes were also made to improve readability, removing needless repeated lines.
The base comparator method currently breaks if you pass an associative array containing a node, because for some reason we can't directly compare arrays, AAs or nodes.
With the following changes, the base comparator will return an early
false
if it sees that both values have different types, and it will also compare node types using theisSameNode
method available on nodes.Some changes were also made to improve readability, removing needless repeated lines.