File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,26 @@ public function close(): void
5252
5353 /**
5454 * Returns true if a system call has been interrupted.
55+ *
56+ * stream_select() returns false when the `select` system call is interrupted by an incoming signal.
5557 */
5658 protected function hasSystemCallBeenInterrupted (): bool
5759 {
5860 $ lastError = $ this ->lastError ;
5961 $ this ->lastError = null ;
6062
61- // stream_select returns false when the `select` system call is interrupted by an incoming signal
62- return null !== $ lastError && false !== stripos ($ lastError , 'interrupted system call ' );
63+ if (null === $ lastError ) {
64+ return false ;
65+ }
66+
67+ if (false !== stripos ($ lastError , 'interrupted system call ' )) {
68+ return true ;
69+ }
70+
71+ // on applications with a different locale than english, the message above is not found because
72+ // it's translated. So we also check for the SOCKET_EINTR constant which is defined under
73+ // Windows and UNIX-like platforms (if available on the platform).
74+ return \defined ('SOCKET_EINTR ' ) && str_starts_with ($ lastError , 'stream_select(): Unable to select [ ' .\SOCKET_EINTR .'] ' );
6375 }
6476
6577 /**
You can’t perform that action at this time.
0 commit comments