From a6cd45ccff81bd03847abf626a6ab0e05e749188 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 4 Aug 2021 12:44:40 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#1313 WireArray::prepend(WireArray $items) adding in unexpected order --- wire/core/WireArray.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wire/core/WireArray.php b/wire/core/WireArray.php index 5ab710f9..5dbbf3d5 100644 --- a/wire/core/WireArray.php +++ b/wire/core/WireArray.php @@ -977,7 +977,7 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count if(!$this->isValidItem($item)) { if($item instanceof WireArray) { - foreach($item as $i) $this->prepend($i); + foreach(array_reverse($item->getArray()) as $i) $this->prepend($i); return $this; } else { throw new WireException("Item prepend to " . get_class($this) . " is not an allowed type");