From b29504655d6c856b81ec084c7a22117c2da93db6 Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Thu, 30 Aug 2018 12:38:30 -0600 Subject: [PATCH] push and unshift create arrays if their target isn't set --- src/FlatArrayTrait.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/FlatArrayTrait.php b/src/FlatArrayTrait.php index 6123891..5f4819f 100644 --- a/src/FlatArrayTrait.php +++ b/src/FlatArrayTrait.php @@ -33,6 +33,9 @@ trait FlatArrayTrait if ($arr !== null && !is_array($arr)) { return; } + if ($arr === null) { + $arr = []; + } array_unshift($arr, $value); $this->set($name, $arr); }