io-developer / php-whois

PHP WHOIS provides parsed and raw whois lookup of domains and ASN routes. PHP 8.0 compatible (5.4+ old versions)
MIT License
438 stars 117 forks source link

Fix SocketLoader timeout #136

Closed zim32 closed 3 years ago

zim32 commented 3 years ago

This commit fixes two issues

1) We need to call stream_set_timeout($handle) to handle socket read timeout, because fsockopen($whoisHost, 43, $errno, $errstr, $this->timeout) is only for establishing connection, not for reading/writing 2) Seems like feof not working correctly on timeout. It continues to return FALSE event after timeout. fread returns empty string and infinite loop occurs. This is very dangerous bug

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? don't know
Fixed tickets -
License MIT