From 344b6bc6fcb7ea48bfbf3a19181c80300397b3fd Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Wed, 8 Feb 2023 22:02:04 +0100 Subject: [PATCH] Initialize new_lines array, #6463 --- install/lib/install.lib.php | 9 ++++----- server/lib/classes/file.inc.php | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php index 10de1d8fbf..5a0b0ceaf5 100644 --- a/install/lib/install.lib.php +++ b/install/lib/install.lib.php @@ -547,16 +547,15 @@ function remove_blank_lines($input, $file = 1){ $content = $input; } $lines = explode("\n", $content); + $new_lines = array(); if(!empty($lines)){ foreach($lines as $line){ if(trim($line) != '') $new_lines[] = $line; } } - if(is_array($new_lines)){ - $content = implode("\n", $new_lines); - } else { - $content = ''; - } + + $content = implode("\n", $new_lines); + if($file){ wf($input, $content); }else{ diff --git a/server/lib/classes/file.inc.php b/server/lib/classes/file.inc.php index 28757d0dd5..0cfdf6f2ed 100644 --- a/server/lib/classes/file.inc.php +++ b/server/lib/classes/file.inc.php @@ -118,16 +118,15 @@ class file{ $content = $input; } $lines = explode("\n", $content); + $new_lines = array(); if(!empty($lines)){ foreach($lines as $line){ if(trim($line) != '') $new_lines[] = $line; } } - if(is_array($new_lines)){ - $content = implode("\n", $new_lines); - } else { - $content = ''; - } + + $content = implode("\n", $new_lines); + if($file){ $this->wf($input, $content); } else { -- GitLab