Skip to content

Commit ce9c8f4

Browse files
authored
Update Socket.php (#156)
On PHP >= 8.1 this throws a TypeError ``` Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given in .\vendor\xpaw\php-source-query-class\SourceQuery\Socket.php:32 ``` Because a failed connection server sets this to boolean false. Better to check if the parameter passed to `fclose()` is an actual resource/stream.
1 parent f38c42b commit ce9c8f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SourceQuery/Socket.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Socket extends BaseSocket
2727
{
2828
public function Close( ) : void
2929
{
30-
if( $this->Socket !== null )
30+
if( is_resource($this->Socket) )
3131
{
3232
fclose( $this->Socket );
3333

0 commit comments

Comments
 (0)