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

Fix `Call to a member function toInt() on float` #191

Closed Sebbo94BY closed 1 year ago

Sebbo94BY commented 1 year ago

Calling e.g. $virtualserver->getInfo(true, true)) caused the error Call to a member function toInt() on float.

Alternative, we could introduce a respective function like this (untested):

/**
 * Returns the float value of the string.
 * @return float
 */
public function toFloat(): float
{
    return floatval($this->string);
}

Current value:

// src/Node/Node.php:158
public function iconGetName(string $key): StringHelper
{
    dd($this[$key]);
    $iconid = floatval($this[$key]);
    [...]
}
3525880661.0 // vendor/planetteamspeak/ts3-php-framework/src/Node/Node.php:158
Sebbo94BY commented 1 year ago

This is also a blocker for bot features on PHP 8.1/8.2.

Sebbo94BY commented 1 year ago

@ronindesign how do we want to proceed with this topic?

Sebbo94BY commented 1 year ago

Any news regarding this, @ronindesign ?

ronindesign commented 1 year ago

I'm fairly certain we don't want to pass floats to ts3server, so closing this now in favor of #192 which results in only integers returning from Node::toInt().

We will revisit if this issue is not resolved by #192 or in the event we need unexpectedly do need a float value for iconID in a certain scenario.