Skip to content

Commit 7607e53

Browse files
committed
Sanitize inputs a bit more
1 parent fa84fc2 commit 7607e53

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Commands/ClearLog.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public function handle()
4141
// now create the channel driver objects safely
4242
$channels = [];
4343
if($this->argument('channel')) {
44-
$channels[] = $this->argument('channel');
44+
$channel = $this->argument('channel');
45+
$channels[] = (string) (is_array($channel) ? $channel[0] : $channel);
4546
// check if this channel is configured
4647
if(empty(config('logging.channels.'.$channels[0]))) {
4748
$this->error('Channel is not configured!');

src/Commands/SearchLog.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public function __construct() {
1818

1919
public function handle() {
2020
// basically, we add the search term to the filter and then we let the parent function handle it normally
21-
$this->filter['search'] = $this->argument('search');
21+
$search = $this->argument('search');
22+
$this->filter['search'] = (string) (is_array($search) ? $search[0] : $search);
2223
$this->line('Running search via log:show for <bg=yellow>'.$this->filter['search'].'</>');
2324
parent::handle();
2425

src/Commands/ShowLog.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public function handle()
7070

7171
// level
7272
if(!empty($this->option('level'))) {
73-
$this->filter['level'] = $this->option('level');
73+
$level = $this->option('level');
74+
$this->filter['level'] = (string) (is_array($level) ? $level[0] : $level);
7475
if(!in_array($this->filter['level'], self::LEVELS)) {
7576
// this is an invalid log level
7677
$this->error('Log Level is invalid, try: '.implode(', ', self::LEVELS));
@@ -81,7 +82,8 @@ public function handle()
8182
// channel filtering
8283
$channels = [];
8384
if(!empty($this->option('channel'))) {
84-
$channels[] = $this->option('channel');
85+
$channel = $this->option('channel');
86+
$channels[] = (string) (is_array($channel) ? $channel[0] : $channel);
8587
// check if this channel is configured
8688
if(empty(config('logging.channels.'.$channels[0]))) {
8789
$this->error('Channel is not configured!');

0 commit comments

Comments
 (0)