From d135a4ec75a4f5f3973c9381f2d1809592c28a5c Mon Sep 17 00:00:00 2001 From: Sieciech Date: Sat, 7 Aug 2021 16:59:39 +0200 Subject: [PATCH] fix --- tools/putenv/putenv.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/putenv/putenv.php b/tools/putenv/putenv.php index 333cf29..865bc18 100644 --- a/tools/putenv/putenv.php +++ b/tools/putenv/putenv.php @@ -44,7 +44,7 @@ class PutEnv { foreach ($this->content as $l => $line) { if (strlen($line) < 1) { if ($lineWasEmpty) { - unset ($this->content[$l]); + $this->content[$l] = null; } else { $lineWasEmpty = true; } @@ -66,6 +66,13 @@ class PutEnv { } else if ($changed > 1) { echo "Key $key changed $changed times\n"; } + $content = $this->content; + $this->content = []; + foreach ($content as $line) { + if ($line !== null) { + $this->content[] = $line; + } + } $content = implode("\n", $this->content); file_put_contents($this->file, $content); }