#285 fclose(): Argument #1 ($stream) must be of type resource, false given
Submitted by PocketMine-MP 5.25.1+dev.2092
General information
| Version: | 5.25.1+dev.2092 | 
|---|---|
| Git commit: | 543c7a50 | 
| Plugin involvement: | Direct | 
| Report date: | 2025-03-06 10:47:45 +0000 UTC | 
| Server uptime: | 14 days 13 hours 42 minutes 35 seconds | 
System Information
| PHP version: | 8.3.13 | 
|---|---|
| JIT status: | Not available | 
| Operating system: | linux | 
| System banner: | Linux anmine.ru 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64 | 
Error information
                            Warning: the Hub plugin was directly involved in this crash. Please contact the plugin author.
                        
                        
                        | Thread: | AsyncWorker#1 | 
|---|---|
| Message: | fclose(): Argument #1 ($stream) must be of type resource, false given | 
| File: | plugins/Hub.phar/src/corndan/Hub/classes/QueryClass | 
| Line: | #20 | 
| Type: | TypeError | 
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
    private $status = false;
    private $errors = [];
    private $info = NULL;
    public function __construct(string $host, int $port, int $timeout = 4)
    {
        $socket = @fsockopen('udp://' . $host, $port, $errno, $errstr, $timeout);
        if ($errno || $socket === false) {
            fclose($socket);
            $this->errors[] = $errno;
            $this->errors[] = $errstr;
            return;
        }
        stream_Set_Timeout($socket, $timeout);
        stream_Set_Blocking($socket, true);
        $OFFLINE_MESSAGE_DATA_ID = pack('c*', 0x00, 0xFF, 0xFF, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0xFD, 0xFD, 0xFD, 0xFD, 0x12, 0x34, 0x56, 0x78);
        $command = pack('cQ', 0x01, time()); // DefaultMessageIDTypes::ID_UNCONNECTED_PING + 64bit current time
        $command .= $OFFLINE_MESSAGE_DATA_ID;
                        #0 /home/anmine/servers/hub/plugins/Hub.phar/src/corndan/Hub/classes/QueryClass(20): fclose(false)
#1 /home/anmine/servers/hub/plugins/Hub.phar/src/corndan/Hub/HubMain(105): corndan\Hub\classes\QueryClass->__construct(string[13] ananasmine.ru, int 19135)
#2 pmsrc/src/scheduler/AsyncTask(89): pocketmine\scheduler\AsyncTask@anonymous�phar:///home/anmine/servers/hub/plugins/Hub.phar/src/corndan/Hub/HubMain.php:95$15a->onRun()
#3 (): pocketmine\scheduler\AsyncTask->run()
Loaded Plugins
- 
                            Show
 
Server Settings
- 
                            Show
 
Installed Composer Dependencies
- 
                            Show
 
Installed PHP Extensions
- 
                            Show