Skip to content

Commit 3de8261

Browse files
authored
Merge pull request #50 from thomascombe/fix/empty-query-param
Prevent error on empty query value
2 parents 2303f57 + 1951953 commit 3de8261

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/Abstracts/Middleware.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public function match($pattern, $input)
109109
}
110110

111111
foreach ($input as $key => $value) {
112+
if (empty($value)) {
113+
continue;
114+
}
115+
112116
if (is_array($value)) {
113117
if (!$result = $this->match($pattern, $value)) {
114118
continue;

src/Middleware/Php.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public function match($pattern, $input)
1919
}
2020

2121
foreach ($input as $key => $value) {
22+
if (empty($value)) {
23+
continue;
24+
}
25+
2226
if (is_array($value)) {
2327
if (!$result = $this->match($pattern, $value)) {
2428
continue;

src/Middleware/Rfi.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public function match($pattern, $input)
2323
}
2424

2525
foreach ($input as $key => $value) {
26+
if (empty($value)) {
27+
continue;
28+
}
29+
2630
if (is_array($value)) {
2731
if (!$result = $this->match($pattern, $value)) {
2832
continue;
@@ -48,7 +52,7 @@ public function match($pattern, $input)
4852

4953
return $result;
5054
}
51-
55+
5256
protected function applyExceptions($string)
5357
{
5458
$exceptions = config('firewall.middleware.' . $this->middleware . '.exceptions');
@@ -62,15 +66,15 @@ protected function applyExceptions($string)
6266

6367
return str_replace($exceptions, '', $string);
6468
}
65-
69+
6670
protected function checkContent($value)
6771
{
6872
$contents = @file_get_contents($value);
6973

7074
if (!empty($contents)) {
7175
return (strstr($contents, '<?php') !== false);
7276
}
73-
77+
7478
return false;
7579
}
7680
}

0 commit comments

Comments
 (0)