Skip to content

[2.x] Fix fclose for socket #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

[2.x] Fix fclose for socket #149

wants to merge 1 commit into from

Conversation

rennokki
Copy link

@rennokki rennokki commented Apr 15, 2021

When closing the socket with fclose, it seems like the $this->socket is false and fclose does not accept boolean:

$query = new SourceQuery;

try {
    $query->connect($this->host, $this->port, 5, SourceQuery::SOURCE); // the host and port are invalid/server is down
} catch (Exception $e) {
    return  [];
}

// Throws: TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given.
// Line: xpaw\php-source-query-class\SourceQuery\Socket.php:33
$query->disconnect();

The code formatting also knocks me off, it seems more related to C# than PSR-7. Are formatting PRs allowed?

@xPaw xPaw closed this in 904e547 Apr 16, 2021
@rennokki rennokki deleted the patch-1 branch April 16, 2021 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant