From 33e373c798b2f821d7896d67be1fef293fff806b Mon Sep 17 00:00:00 2001 From: Netkas Date: Wed, 7 Dec 2022 19:47:44 -0500 Subject: [PATCH] Bug fix in \ncc\Objects > Vault > deleteEntry() https://git.n64.cc/nosial/ncc/-/issues/27 --- src/ncc/Objects/Vault.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ncc/Objects/Vault.php b/src/ncc/Objects/Vault.php index 65e1698..87338b5 100644 --- a/src/ncc/Objects/Vault.php +++ b/src/ncc/Objects/Vault.php @@ -74,15 +74,18 @@ */ public function deleteEntry(string $name): bool { - foreach($this->Entries as $entry) + // Find the entry + foreach($this->Entries as $index => $entry) { if($entry->getName() === $name) { - $this->Entries = array_diff($this->Entries, [$entry]); + // Remove the entry + unset($this->Entries[$index]); return true; } } + // Entry not found return false; }