require internal validation

This commit is contained in:
ghost 2023-12-16 15:49:41 +02:00
parent b3ff41751d
commit 26315c924f

View file

@ -30,14 +30,19 @@ class Socket
public static function isOpen(string $host, int $port = -1, ?float $timeout = null, int &$error_code = null, string &$error_message = null): bool public static function isOpen(string $host, int $port = -1, ?float $timeout = null, int &$error_code = null, string &$error_message = null): bool
{ {
return is_resource( if (self::isHost($host) && self::isPort($port))
@fsockopen( {
$host, return is_resource(
$port, @fsockopen(
$error_code, $host,
$error_message, $port,
$timeout $error_code,
) $error_message,
); $timeout
)
);
}
return false;
} }
} }