You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set, Summary, Math, Reduce: floats were compared at the precision ini setting (14 digits by default) instead of by exact value, so 0.1 + 0.2 and 0.3 could be treated as equal and results depended on precision/serialize_precision; floats now compare by exact value.
Set, Summary, Math, Reduce: in strict mode -0.0 and 0.0 were treated as different values although -0.0 === 0.0; they are now equal.
Set, Summary, Math, Reduce: in coercive mode, integers beyond 2^53 (e.g. 9007199254740992 and 9007199254740993) were treated as equal; they now compare by exact value.
Set, Summary, Math, Reduce: a resource was treated as a different value once closed; a resource now keeps one identity whether open or closed.
Set, Summary, Math, Reduce: arrays containing closures or generators threw a bare \Exception instead of the documented \InvalidArgumentException, and arrays containing different resources compared equal to each other, and to 0.
Summary: allUnique could return false for distinct objects when objects were freed during iteration.
Set, Summary, Math, Reduce: objects, closures, generators, and resources nested inside arrays could be falsely treated as equal to a later, unrelated value when the original was freed or its reference slot reassigned during iteration (e.g. a generator yielding [&$slot] and reassigning $slot).
Set: symmetricDifference and symmetricDifferenceCoercive silently dropped arrays holding a reference slot that was reassigned after being yielded.
Summary: arePermutations and arePermutationsCoercive could return true for non-permutations when arrays held reference slots reassigned onto a shared value.
Summary: containsCoercive could match the wrong value when the needle was an array holding a closure, generator, or resource through a reassigned reference slot.
Changes
Arrays now compare element-wise under the active mode. In strict mode, nested objects, closures, generators, and resources compare by instance, and nested -0.0 equals 0.0. In coercive mode, [1] and ['1'] are now equal (e.g. Set::distinct([[1], ['1']], false) yields one element; Set::unionCoercive([[1]], [['1']]) yields one).
Arrays nested deeper than 256 levels, including self-referential arrays, now throw \InvalidArgumentException.
Coercive scalar comparison is documented as numeric equivalence, not PHP ==: 'abc' is not equal to true, and 0, '', null, and false remain one value.
intersection*, partialIntersection*, union*, difference*, arePermutations*, and Summary::allUnique use less memory on large inputs.