From c238c6136180810b2519fadacc1fd0e13541fb48 Mon Sep 17 00:00:00 2001 From: "Adrian P. Blunier" Date: Tue, 21 Oct 2014 15:37:06 +0200 Subject: [PATCH] Fixed Entries::mergeWith with method MERGE_REMOVE It was throwing an ArrayIterator::next(): Array was modified outside object and internal position is no longer valid --- Gettext/Entries.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gettext/Entries.php b/Gettext/Entries.php index cefe0dd9..2be86f3e 100644 --- a/Gettext/Entries.php +++ b/Gettext/Entries.php @@ -200,9 +200,11 @@ public function mergeWith(Entries $entries, $method = null) } if ($method & self::MERGE_REMOVE) { - foreach ($this as $k => $entry) { + $iterator = $this->getIterator(); + + foreach ($iterator as $k => $entry) { if (!($existing = $entries->find($entry))) { - unset($this[$k]); + $iterator->offsetUnset($k); } } }