Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/Valet/Drivers/Specific/CraftValetDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ public function frontControllerPath(string $sitePath, string $siteName, string $
$_SERVER['PHP_SELF'] = $scriptName;
$_SERVER['DOCUMENT_ROOT'] = $sitePath.'/'.$frontControllerDirectory;

if (isset($_SERVER['argv'])) {
unset($_SERVER['argv']);
}

return $indexPath;
}
}
2 changes: 1 addition & 1 deletion cli/Valet/Drivers/ValetDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function loadServerEnvironmentVariables(string $sitePath, string $siteNam
return;
}

$variables = include_once $varFilePath;
$variables = include $varFilePath;

$variablesToSet = $variables['*'] ?? [];

Expand Down
2 changes: 1 addition & 1 deletion cli/Valet/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function domainFromSiteName(string $siteName): string
public static function show404()
{
http_response_code(404);
require_once __DIR__.'/../../cli/templates/404.html';
require __DIR__.'/../../cli/templates/404.html';
exit;
}

Expand Down
18 changes: 17 additions & 1 deletion server.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@
Server::show404();
}

/**
* Unset our variables to avoid leaking Valet internals into the user's application.
*/
unset(
$valetConfig,
$uriForIpAddressExtraction,
$host,
$server,
$uri,
$siteName,
$valetSitePath,
$valetDriver,
$isPhpFile,
$staticFilePath,
);

chdir(dirname($frontControllerPath));

require_once $frontControllerPath;
require $frontControllerPath;
Loading