Skip to content
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

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

Closed
MajorOli opened this issue Sep 24, 2023 · 4 comments
Closed

Comments

@MajorOli
Copy link

MajorOli commented Sep 24, 2023

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
Copy link

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
Copy link
Author

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
Copy link
Author

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

@MajorOli
Copy link
Author

MajorOli commented Feb 9, 2025

#222 solved the Issue. Its tested in Rework and implement extended Tests

@MajorOli MajorOli closed this as completed Feb 9, 2025
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

No branches or pull requests

2 participants