Skip to content

Commit

Permalink
ENH PHP 8.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Apr 4, 2022
1 parent deecedd commit 0bf0082
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion code/PortChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function isPortOpen($host, $port)
$host = 'localhost';
}

$connection = @fsockopen($host, $port);
$connection = @fsockopen((string) $host, (int) $port);
if (is_resource($connection)) {
fclose($connection);
return true;
Expand Down
4 changes: 2 additions & 2 deletions code/ServerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public function launchServer($options)
$port = PortChecker::findNextAvailablePort($host, $options['preferredPort']);

$base = __DIR__;
$command = "exec " . escapeshellcmd($bin) .
$command = "exec " . escapeshellcmd((string) $bin) .
' -S ' . escapeshellarg($host . ':' . $port) .
' -t ' . escapeshellarg($this->path) . ' ' .
' -t ' . escapeshellarg((string) $this->path) . ' ' .
escapeshellarg($base . '/server-handler.php');

if (!empty($options['bootstrapFile'])) {
Expand Down
2 changes: 1 addition & 1 deletion code/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Detect BASE_PATH with public-folder awareness
define(
'BASE_PATH',
basename(getcwd()) === 'public'
basename((string) getcwd()) === 'public'
? dirname(getcwd())
: getcwd()
);
2 changes: 1 addition & 1 deletion code/server-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
(string) parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

if ($uri !== "/" && file_exists(PUBLIC_PATH . $uri) && !is_dir(PUBLIC_PATH . $uri)) {
Expand Down

0 comments on commit 0bf0082

Please sign in to comment.