Skip to content

Commit 4052ec7

Browse files
author
Till Brehm
committed
Merge branch '6452-uncaught-typeerror-array_merge-argument-1-must-be-of-type-array-bool-given-in' into 'develop'
Resolve "Uncaught TypeError: array_merge(): Argument 1 must be of type array, bool given in shelluser_base_plugin.inc.php:480" Closes #6452 See merge request ispconfig/ispconfig3!1689
2 parents 35d9790 + 8e5c13b commit 4052ec7

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

server/lib/classes/file.inc.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ function remove_blank_lines($input, $file = 1){
124124
if(trim($line) != '') $new_lines[] = $line;
125125
}
126126
}
127-
128-
$content = implode("\n", $new_lines);
129-
127+
if(!empty($new_lines)){
128+
$content = implode("\n", $new_lines);
129+
} else {
130+
$content = '';
131+
}
130132
if($file){
131133
$this->wf($input, $content);
132134
} else {

server/plugins-available/shelluser_base_plugin.inc.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,11 @@ private function _setup_ssh_rsa() {
477477
// Remove duplicate keys
478478
$existing_keys = @file($sshkeys, FILE_IGNORE_NEW_LINES);
479479
$new_keys = explode("\n", $userkey);
480-
$final_keys_arr = @array_merge($existing_keys, $new_keys);
480+
if(is_array($existing_keys)) {
481+
$final_keys_arr = @array_merge($existing_keys, $new_keys);
482+
} else {
483+
$final_keys_arr = $new_keys;
484+
}
481485
$new_final_keys_arr = array();
482486
if(is_array($final_keys_arr) && !empty($final_keys_arr)){
483487
foreach($final_keys_arr as $key => $val){

server/plugins-available/shelluser_jailkit_plugin.inc.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ function _setup_jailkit_chroot()
318318
$options = array('hardlink');
319319
} elseif ($this->jailkit_config['jailkit_hardlinks'] == 'no') {
320320
$options = array();
321+
} else {
322+
$options = array();
321323
}
322324
} else {
323325
$options = array('allow_hardlink');
@@ -527,7 +529,11 @@ private function _setup_ssh_rsa() {
527529
// Remove duplicate keys
528530
$existing_keys = @file($sshkeys, FILE_IGNORE_NEW_LINES);
529531
$new_keys = explode("\n", $userkey);
530-
$final_keys_arr = @array_merge($existing_keys, $new_keys);
532+
if(is_array($existing_keys)) {
533+
$final_keys_arr = @array_merge($existing_keys, $new_keys);
534+
} else {
535+
$final_keys_arr = $new_keys;
536+
}
531537
$new_final_keys_arr = array();
532538
if(is_array($final_keys_arr) && !empty($final_keys_arr)){
533539
foreach($final_keys_arr as $key => $val){

0 commit comments

Comments
 (0)