Skip to content

Commit

Permalink
fix #2367
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsn committed Feb 29, 2020
1 parent e10ecdb commit be9c0f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions system/Commands/Server/Serve.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ class Serve extends BaseCommand
/**
* The current port offset.
*
* @var int
* @var integer
*/
protected $portOffset = 0;

/**
* The max number of ports to attempt to serve from
*
* @var int
* @var integer
*/
protected $tries = 10;

Expand Down Expand Up @@ -136,7 +136,7 @@ public function run(array $params)
}

// Collect any user-supplied options and apply them.
$php = CLI::getOption('php') ?? PHP_BINARY;
$php = escapeshellarg(CLI::getOption('php') ?? PHP_BINARY);
$host = CLI::getOption('host') ?? 'localhost';
$port = (int) (CLI::getOption('port') ?? '8080') + $this->portOffset;

Expand All @@ -155,7 +155,8 @@ public function run(array $params)
// to ensure our environment is set and it simulates basic mod_rewrite.
passthru($php . ' -S ' . $host . ':' . $port . ' -t ' . $docroot . ' ' . $rewrite, $status);

if ($status && $this->portOffset < $this->tries) {
if ($status && $this->portOffset < $this->tries)
{
$this->portOffset += 1;

$this->run($params);
Expand Down

0 comments on commit be9c0f2

Please sign in to comment.