Skip to content

Commit

Permalink
兼容低版本PHP,优化匹配方式
Browse files Browse the repository at this point in the history
  • Loading branch information
qeq66 authored and yunwuxin committed Oct 31, 2023
1 parent 979d921 commit fcd5cf5
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/HandleCors.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
class HandleCors
{
/** @var string[] */
protected array $paths = [];
protected $paths = [];
/** @var string[] */
protected array $allowedOrigins = [];
protected $allowedOrigins = [];
/** @var string[] */
protected array $allowedOriginsPatterns = [];
protected $allowedOriginsPatterns = [];
/** @var string[] */
protected array $allowedMethods = [];
protected $allowedMethods = [];
/** @var string[] */
protected array $allowedHeaders = [];
protected $allowedHeaders = [];
/** @var string[] */
private array $exposedHeaders = [];
protected bool $supportsCredentials = false;
protected ?int $maxAge = 0;
private $exposedHeaders = [];
protected $supportsCredentials = false;
protected $maxAge = 0;

protected bool $allowAllOrigins = false;
protected bool $allowAllMethods = false;
protected bool $allowAllHeaders = false;
protected $allowAllOrigins = false;
protected $allowAllMethods = false;
protected $allowAllHeaders = false;

public function __construct(Config $config)
{
Expand Down Expand Up @@ -199,7 +199,7 @@ protected function isOriginAllowed(Request $request): bool

protected function hasMatchingPath(Request $request)
{
$url = $request->baseUrl();
$url = $request->pathInfo();
$url = trim($url, '/');
if ($url === '') {
$url = '/';
Expand Down

0 comments on commit fcd5cf5

Please sign in to comment.