From 99be2d903be8dea4dfa8ece1ecd49fb903fe3952 Mon Sep 17 00:00:00 2001 From: Dumi Jay Date: Mon, 21 Dec 2020 09:14:43 +0530 Subject: [PATCH 1/3] Changed deprecated {} to [] to access array elements Deprecated in 7.4: https://wiki.php.net/rfc/deprecate_curly_braces_array_access Throws an error in PHP 8 --- src/whois.idna.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/whois.idna.php b/src/whois.idna.php index 4aa3c0b..add5eba 100644 --- a/src/whois.idna.php +++ b/src/whois.idna.php @@ -374,7 +374,7 @@ class idna_convert $delim_pos = strrpos($encoded, '-'); if ($delim_pos > strlen($this->_punycode_prefix)) { for ($k = strlen($this->_punycode_prefix); $k < $delim_pos; ++$k) { - $decoded[] = ord($encoded{$k}); + $decoded[] = ord($encoded[$k]); } } else { $decoded = array(); @@ -390,7 +390,7 @@ class idna_convert for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) { - $digit = $this->_decode_digit($encoded{$enco_idx++}); + $digit = $this->_decode_digit($encoded[$enco_idx++]); $idx += $digit * $w; $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); @@ -793,7 +793,7 @@ class idna_convert $mode = 'next'; $test = 'none'; for ($k = 0; $k < $inp_len; ++$k) { - $v = ord($input{$k}); // Extract byte from input string + $v = ord($input[$k]); // Extract byte from input string if ($v < 128) { // We found an ASCII char - put into stirng as is $output[$out_len] = $v; @@ -932,7 +932,7 @@ class idna_convert $out_len++; $output[$out_len] = 0; } - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); + $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) ); } return $output; } @@ -966,4 +966,4 @@ class Net_IDNA_php4 extends idna_convert } } -?> \ No newline at end of file +?> From 84113d657e1b5448e2f0b6c1cdc28c39da3af598 Mon Sep 17 00:00:00 2001 From: Pedro Cardoso da Silva Date: Tue, 15 Jun 2021 17:15:00 -0300 Subject: [PATCH 2/3] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6697ed4..752dbd4 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ or not and which is the registrar but not the owner information. ### UTF-8 -PHPWhois will assume that all whois servers resturn UTF-8 encoded output, +PHPWhois will assume that all whois servers return UTF-8 encoded output, if some whois server does not return UTF-8 data, you can include it in the `NON_UTF8` array in whois.servers.php From 24fff22f9b73798610987c765c0659742229b472 Mon Sep 17 00:00:00 2001 From: Pedro Cardoso da Silva Date: Tue, 29 Jun 2021 16:27:40 -0300 Subject: [PATCH 3/3] Failsafe stream_select Fixes #9 --- src/whois.client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/whois.client.php b/src/whois.client.php index 651f5d1..70004f4 100644 --- a/src/whois.client.php +++ b/src/whois.client.php @@ -194,7 +194,7 @@ class WhoisClient { while (!feof($ptr)) { - if (stream_select($r,$null,$null,$this->STIMEOUT)) + if (@stream_select($r,$null,$null,$this->STIMEOUT)!==false) { $raw .= fgets($ptr, $this->BUFFER); }