diff --git a/app/Console/Commands/ClearUser.php b/app/Console/Commands/ClearUser.php index 30eb338..cd64abe 100644 --- a/app/Console/Commands/ClearUser.php +++ b/app/Console/Commands/ClearUser.php @@ -45,7 +45,7 @@ class ClearUser extends Command ->where('last_login_at', NULL); $count = $builder->count(); if ($builder->delete()) { - $this->info("已删除${count}位没有任何数据的用户"); + $this->info("已删除{$count}位没有任何数据的用户"); } } } diff --git a/app/Http/Controllers/V1/Client/ClientController.php b/app/Http/Controllers/V1/Client/ClientController.php index f115c20..832f9d6 100644 --- a/app/Http/Controllers/V1/Client/ClientController.php +++ b/app/Http/Controllers/V1/Client/ClientController.php @@ -107,7 +107,7 @@ class ClientController extends Controller private function getFilterArray(?string $filter): ?array { - return mb_strlen($filter ?? '') > 20 ? null : + return mb_strlen((string) $filter) > 20 ? null : explode('|', str_replace(['|', '|', ','], '|', $filter)); } diff --git a/app/Http/Controllers/V1/Server/UniProxyController.php b/app/Http/Controllers/V1/Server/UniProxyController.php index e5330b0..645f6ff 100644 --- a/app/Http/Controllers/V1/Server/UniProxyController.php +++ b/app/Http/Controllers/V1/Server/UniProxyController.php @@ -32,7 +32,7 @@ class UniProxyController extends Controller $response['users'] = $users; $eTag = sha1(json_encode($response)); - if (strpos($request->header('If-None-Match'), $eTag) !== false) { + if (strpos($request->header('If-None-Match', ''), $eTag) !== false) { return response(null, 304); } diff --git a/app/Http/Controllers/V1/User/ServerController.php b/app/Http/Controllers/V1/User/ServerController.php index b2f7b15..f12b005 100644 --- a/app/Http/Controllers/V1/User/ServerController.php +++ b/app/Http/Controllers/V1/User/ServerController.php @@ -20,7 +20,7 @@ class ServerController extends Controller $servers = ServerService::getAvailableServers($user); } $eTag = sha1(json_encode(array_column($servers, 'cache_key'))); - if (strpos($request->header('If-None-Match'), $eTag) !== false ) { + if (strpos($request->header('If-None-Match', ''), $eTag) !== false ) { return response(null,304); } $data = NodeResource::collection($servers); diff --git a/app/Protocols/Clash.php b/app/Protocols/Clash.php index 00f012d..187f386 100644 --- a/app/Protocols/Clash.php +++ b/app/Protocols/Clash.php @@ -231,6 +231,9 @@ class Clash implements ProtocolInterface private function isRegex($exp) { - return @preg_match($exp, null) !== false; + if (empty($exp)) { + return false; + } + return @preg_match((string)$exp, '') !== false; } } diff --git a/app/Protocols/ClashMeta.php b/app/Protocols/ClashMeta.php index 21af0bc..70078d5 100644 --- a/app/Protocols/ClashMeta.php +++ b/app/Protocols/ClashMeta.php @@ -333,6 +333,9 @@ class ClashMeta implements ProtocolInterface private function isRegex($exp) { - return @preg_match($exp, null) !== false; + if (empty($exp)) { + return false; + } + return @preg_match($exp, '') !== false; } } diff --git a/app/Protocols/Stash.php b/app/Protocols/Stash.php index 2b14165..179dcc2 100644 --- a/app/Protocols/Stash.php +++ b/app/Protocols/Stash.php @@ -284,7 +284,10 @@ class Stash implements ProtocolInterface private function isRegex($exp) { - return @preg_match($exp, null) !== false; + if (empty($exp)) { + return false; + } + return @preg_match($exp, '') !== false; } private function isMatch($exp, $str) diff --git a/config/logging.php b/config/logging.php index beb2834..3e3e90e 100755 --- a/config/logging.php +++ b/config/logging.php @@ -100,6 +100,13 @@ return [ 'driver' => 'errorlog', 'level' => 'debug', ], + + 'deprecations' => [ + 'driver' => 'daily', + 'path' => storage_path('logs/deprecations.log'), + 'level' => 'debug', + 'days' => 14, + ], ], ]; diff --git a/routes/websocket.php b/routes/websocket.php deleted file mode 100644 index ddebfe1..0000000 --- a/routes/websocket.php +++ /dev/null @@ -1,26 +0,0 @@ -emit('message', $data); -}); diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php deleted file mode 100755 index 5fa7829..0000000 --- a/tests/Bootstrap.php +++ /dev/null @@ -1,42 +0,0 @@ -createApplication()->make(Kernel::class); - - $commands = [ - 'config:cache', - 'event:cache', - ]; - - foreach ($commands as $command) { - $console->call($command); - } - } - - public function executeAfterLastTest(): void - { - array_map('unlink', glob('bootstrap/cache/*.phpunit.php')); - } -} diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php deleted file mode 100755 index ab92402..0000000 --- a/tests/CreatesApplication.php +++ /dev/null @@ -1,22 +0,0 @@ -make(Kernel::class)->bootstrap(); - - return $app; - } -} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php deleted file mode 100755 index cdb5111..0000000 --- a/tests/Feature/ExampleTest.php +++ /dev/null @@ -1,21 +0,0 @@ -get('/'); - - $response->assertStatus(200); - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100755 index 2932d4a..0000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,10 +0,0 @@ -assertTrue(true); - } -}