Skip to content

Commit

Permalink
Merge pull request #8995 from kenjis/fix-command-loads-rewrite.php
Browse files Browse the repository at this point in the history
fix: `command()` may execute `rewrite.php`
  • Loading branch information
kenjis authored Jun 25, 2024
2 parents e0e8f83 + 9f6bf3f commit dd39902
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion system/Commands/Server/Serve.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function run(array $params)
$docroot = escapeshellarg(FCPATH);

// Mimic Apache's mod_rewrite functionality with user settings.
$rewrite = escapeshellarg(__DIR__ . '/rewrite.php');
$rewrite = escapeshellarg(SYSTEMPATH . 'rewrite.php');

// Call PHP's built-in webserver, making sure to set our
// base path to the public folder, and to use the rewrite file
Expand Down
5 changes: 0 additions & 5 deletions system/Commands/Server/rewrite.php → system/rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
*/

// @codeCoverageIgnoreStart
// Avoid this file run when listing commands
if (PHP_SAPI === 'cli') {
return;
}

$uri = urldecode(
parse_url('https://codeigniter.com' . $_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? ''
);
Expand Down

0 comments on commit dd39902

Please sign in to comment.