From ba4414c2f3788b64de17e922d0496f6913c05898 Mon Sep 17 00:00:00 2001 From: uzulla Date: Tue, 18 Jan 2022 12:46:16 +0900 Subject: [PATCH] Fix: avoid warn when cast float to int in PHP7.1. I got some error. ``` Implicit conversion from float 992216.1102294922 to int loses precision --- ``` --- phpseclib/Net/SSH2.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index b7c1b920..2a4ebe45 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1331,8 +1331,8 @@ class Net_SSH2 $read = array($this->fsock); $write = $except = null; $start = strtok(microtime(), ' ') + strtok(''); - $sec = floor($this->curTimeout); - $usec = 1000000 * ($this->curTimeout - $sec); + $sec = (int) floor($this->curTimeout); + $usec = (int) (1000000 * ($this->curTimeout - $sec)); // on windows this returns a "Warning: Invalid CRT parameters detected" error // the !count() is done as a workaround for if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) { @@ -3518,8 +3518,8 @@ class Net_SSH2 $this->curTimeout-= $elapsed; } - $sec = floor($this->curTimeout); - $usec = 1000000 * ($this->curTimeout - $sec); + $sec = (int)floor($this->curTimeout); + $usec = (int)(1000000 * ($this->curTimeout - $sec)); // on windows this returns a "Warning: Invalid CRT parameters detected" error if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) {