From 08537a7ed6d2c463f76278081ac7af9a6dd1dead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20N=C3=BCrnberger?= Date: Tue, 6 Apr 2021 19:13:42 +0200 Subject: [PATCH] use str_starts_with (#89) --- src/Swoole/SwooleClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Swoole/SwooleClient.php b/src/Swoole/SwooleClient.php index 28c06db79..928b4792e 100644 --- a/src/Swoole/SwooleClient.php +++ b/src/Swoole/SwooleClient.php @@ -68,7 +68,7 @@ protected function fileIsServable(string $publicPath, string $pathToFile): bool { return $pathToFile && ! in_array(pathinfo($pathToFile, PATHINFO_EXTENSION), ['php', 'htaccess', 'config']) && - substr($pathToFile, 0, strlen($publicPath)) === $publicPath && + str_starts_with($pathToFile, $publicPath) && is_file($pathToFile) && filesize($pathToFile); }