File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ Networking changelog
55
66## 10.2.1 / 2021-06-03
77
8+ * Fixed timeouts for reading from sockets with newer PHP 8.1 builds
9+ (@thekid )
810* Fixed floating point values for ` Socket::setTimeout() ` - @thekid
911* Fixed warning * Declaration of AsyncServer::listen($socket, $protocol)
1012 should be compatible* in PHP 7.0, 7.1 and 7.2
Original file line number Diff line number Diff line change @@ -313,7 +313,12 @@ public function readBinary($maxLen= 4096) {
313313
314314 $ res = fread ($ this ->_sock , $ maxLen );
315315 if (false === $ res || null === $ res ) {
316- $ e = new SocketException ('Read of ' .$ maxLen .' bytes failed: ' .$ this ->getLastError ());
316+ $ m = stream_get_meta_data ($ this ->_sock );
317+ if ($ m ['timed_out ' ]) {
318+ $ e = new SocketTimeoutException ('Read of ' .$ maxLen .' bytes failed: ' .$ this ->getLastError (), $ this ->_timeout );
319+ } else {
320+ $ e = new SocketException ('Read of ' .$ maxLen .' bytes failed: ' .$ this ->getLastError ());
321+ }
317322 \xp::gc (__FILE__ );
318323 throw $ e ;
319324 } else if ('' === $ res ) {
You can’t perform that action at this time.
0 commit comments