Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit fa2ea02

Browse files
committed
Adds additional checks or argv as it can be modified by user
We try to detect the script file name only if argv[0] is set and is non empty string.
1 parent d7cc04a commit fa2ea02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PhpEnvironment/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ protected function detectBaseUrl()
493493
// @see https://www.php.net/manual/en/reserved.variables.server.php
494494
if (PHP_SAPI === 'cli') {
495495
$argv = $this->getServer()->get('argv', []);
496-
if (strpos($filename, $argv[0]) === 0) {
496+
if (isset($argv[0]) && is_string($argv[0]) && $argv[0] !== '' && strpos($filename, $argv[0]) === 0) {
497497
$filename = substr($filename, strlen($argv[0]));
498498
}
499499
}

0 commit comments

Comments
 (0)