planetteamspeak / ts3phpframework

Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
https://www.planetteamspeak.com
GNU General Public License v3.0
209 stars 59 forks source link

convert error at channel->getInfo() and ts3_VirtualServer->clientInfoDb() #212

Open MajorOli opened 11 months ago

MajorOli commented 11 months ago

Im try to Upgrade to Version 1.2.1 with PHP 8.1 and now i get the following error:

#message: "convert error"
  #code: 1540
  #file: "G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Adapter\ServerQuery\Reply.php"
  #line: 311
  #raw_code: 1540
  #raw_mesg: "convert error"
  #return_code: null

For channel->getInfo()

channel->getInfo() will throw the error with bool $extend = true when switch to bool $extend = false the error will not thrown

trace: {▼
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Adapter\ServerQuery\Reply.php:311 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Adapter\ServerQuery\Reply->fetchError(StringHelper $err): void …
      › 
      ›     throw new ServerQueryException($this->getErrorProperty("msg") . $suffix, $this->getErrorProperty("id"), $this->getErrorProperty("return_code"));
      › }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Adapter\ServerQuery\Reply.php:100 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Adapter\ServerQuery\Reply->__construct(array $rpl, string $cmd = '', Host $con = null, bool $exp = true) …
      › 
      › $this->fetchError(array_pop($rpl));
      › $this->fetchReply($rpl);
      arguments: {▼
        $err: PlanetTeamSpeak\TeamSpeak3Framework\Helper\StringHelper {#2005 …}
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Adapter\ServerQuery.php:154 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Adapter\ServerQuery->request(string $cmd, bool $throw = true): Reply …
      › 
      › $reply = new Reply($rpl, $cmd, $this->getHost(), $throw);
      › 
      arguments: {▼
        $rpl: []
        $cmd: "channelinfo cid=㌸"
        $con: PlanetTeamSpeak\TeamSpeak3Framework\Node\Host {#1482 …}
        $exp: true
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Node.php:88 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Node->request(string $cmd, bool $throw = true): Reply …
      › {
      ›     return $this->getParent()->request($cmd, $throw);
      › }
      arguments: {▼
        $cmd: "channelinfo cid=㌸"
        $throw: true
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Server.php:99 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Server->request(string $cmd, bool $throw = true): Reply …
      › 
      ›     return $this->getParent()->request($cmd, $throw);
      › }
      arguments: {▼
        $cmd: "channelinfo cid=㌸"
        $throw: true
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Node.php:88 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Node->request(string $cmd, bool $throw = true): Reply …
      › {
      ›     return $this->getParent()->request($cmd, $throw);
      › }
      arguments: {▼
        $cmd: "channelinfo cid=㌸"
        $throw: true
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Node.php:114 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Node->execute($cmd, array $params = []): Reply …
      › {
      ›     return $this->request($this->prepare($cmd, $params));
      › }
      arguments: {▼
        $cmd: "channelinfo cid=㌸"
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Channel.php:541 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Channel->fetchNodeInfo() …
      › {
      ›     $this->nodeInfo = array_merge($this->nodeInfo, $this->execute("channelinfo", ["cid" => $this->getId()])->toList());
      › }
      arguments: {▼
        $cmd: "channelinfo"
        $params: array:1 [ …1]
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Node.php:286 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Node->getInfo(bool $extend = true, bool $convert = false): array …
      › if ($extend) {
      ›     $this->fetchNodeInfo();
      › }
    }

For ts3_VirtualServer->clientInfoDb()

trace: {▼
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Adapter\ServerQuery\Reply.php:311 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Adapter\ServerQuery\Reply->fetchError(StringHelper $err): void …
      › 
      ›     throw new ServerQueryException($this->getErrorProperty("msg") . $suffix, $this->getErrorProperty("id"), $this->getErrorProperty("return_code"));
      › }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Adapter\ServerQuery\Reply.php:100 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Adapter\ServerQuery\Reply->__construct(array $rpl, string $cmd = '', Host $con = null, bool $exp = true) …
      › 
      › $this->fetchError(array_pop($rpl));
      › $this->fetchReply($rpl);
      arguments: {▼
        $err: PlanetTeamSpeak\TeamSpeak3Framework\Helper\StringHelper {#2326 …}
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Adapter\ServerQuery.php:154 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Adapter\ServerQuery->request(string $cmd, bool $throw = true): Reply …
      › 
      › $reply = new Reply($rpl, $cmd, $this->getHost(), $throw);
      › 
      arguments: {▼
        $rpl: []
        $cmd: "clientdbinfo cldbid=ㄱ"
        $con: PlanetTeamSpeak\TeamSpeak3Framework\Node\Host {#1482 …}
        $exp: true
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Node.php:88 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Node->request(string $cmd, bool $throw = true): Reply …
      › {
      ›     return $this->getParent()->request($cmd, $throw);
      › }
      arguments: {▼
        $cmd: "clientdbinfo cldbid=ㄱ"
        $throw: true
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Server.php:99 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Server->request(string $cmd, bool $throw = true): Reply …
      › 
      ›     return $this->getParent()->request($cmd, $throw);
      › }
      arguments: {▼
        $cmd: "clientdbinfo cldbid=ㄱ"
        $throw: true
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Node.php:114 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Node->execute($cmd, array $params = []): Reply …
      › {
      ›     return $this->request($this->prepare($cmd, $params));
      › }
      arguments: {▼
        $cmd: "clientdbinfo cldbid=ㄱ"
      }
    }
    G:\derrabot\vendor\planetteamspeak\ts3-php-framework\src\Node\Server.php:715 {▼
      PlanetTeamSpeak\TeamSpeak3Framework\Node\Server->clientInfoDb(int $cldbid): array …
      › {
      ›     return $this->execute("clientdbinfo", ["cldbid" => $cldbid])->toList();
      › }
      arguments: {▼
        $cmd: "clientdbinfo"
        $params: array:1 [ …1]
      }
    }
    G:\derrabot\app\Http\Controllers\ts3Config\Ts3ConfigController.php:245 {▼
      App\Http\Controllers\ts3Config\Ts3ConfigController->ts3ServerInitializing($serverID): array …
      › //get userinfo by db id
      › $userDbInfo = $ts3_VirtualServer->clientInfoDb($cldbid);
      › //store info
      arguments: {▼
        $cldbid: 11
      }
    }
MitoCodeGithub commented 11 months ago

I don't know what you really want to do but you can use $ts3_VirtualServer->channelGetByName("MyChannel") to get all properties about your channel and use $ts3_VirtualServer->clientInfoDb(dbid) to get all properties about your client.

MajorOli commented 11 months ago

I want to get all properties from a channel or from the clientInfoDb. At some channels or clientInfoDb (but not at all) the convert error will thrown. But I can not find the property which triggers this error.

//get all channels as collection without SubChannels
$ts3Channels = collect($ts3_VirtualServer->channelList(['pid'=>0]));
foreach ($ts3Channels->keys()->all() as $cid)
{
    //get channel by id
    $channel = $ts3_VirtualServer->channelGetById($cid);
    //get channel info
    $channelInfo = $channel->getInfo();
    //DO SOMETHING
}
//TS3 DATABASE
$usersTs3DB = collect($ts3_VirtualServer->clientListDb());
foreach ($usersTs3DB->keys()->all() as $cldbid)
{
    //get userinfo by db id
    $userDbInfo = $ts3_VirtualServer->clientInfoDb($cldbid);
   //DO SOMETHING
}
MajorOli commented 11 months ago

Info: After i downgrade to Version 1.2.0 the error will not thrown anymore.