From bb0c1173ba821ad198d782e4e3456cd080c12673 Mon Sep 17 00:00:00 2001 From: Jeff Welch Date: Sat, 30 Aug 2014 01:52:09 -0400 Subject: [PATCH] Refs #1413: Avoid infinite loops when restoring the iterator position. --- src/Framework/Constraint/Count.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Framework/Constraint/Count.php b/src/Framework/Constraint/Count.php index 1ce9d3d0c23..194844c097c 100644 --- a/src/Framework/Constraint/Count.php +++ b/src/Framework/Constraint/Count.php @@ -106,7 +106,7 @@ protected function getCountOf($other) // moves pointer if ($key !== null) { $iterator->rewind(); - while ($key !== $iterator->key()) { + while ($iterator->valid() && $key !== $iterator->key()) { $iterator->next(); } }