Skip to content

Commit

Permalink
fix: forceSecureAccess() position
Browse files Browse the repository at this point in the history
It was before the event `pre_system`.
  • Loading branch information
kenjis committed Oct 22, 2023
1 parent b1c9fb8 commit df3d93a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,20 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
$this->getRequestObject();
$this->getResponseObject();

try {
$this->forceSecureAccess();
} catch (RedirectException $e) {
$this->response = $e->getResponse();

if ($returnResponse) {
return $this->response;
}

$this->sendResponse();

return;
}

Events::trigger('pre_system');

$this->benchmark->stop('bootstrap');
Expand All @@ -354,8 +368,6 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon
$this->response = $possibleResponse;
} else {
try {
$this->forceSecureAccess();

$this->response = $this->handleRequest($routes, config(Cache::class), $returnResponse);
} catch (ResponsableInterface|DeprecatedRedirectException $e) {
$this->outputBufferingEnd();
Expand Down

0 comments on commit df3d93a

Please sign in to comment.