Art-of-WiFi / UniFi-API-client

A PHP API client class to interact with Ubiquiti's UniFi Controller API
MIT License
1.09k stars 217 forks source link

Update list_clients to only trim and lowercase $client_mac if not null #140

Closed djchen closed 2 years ago

djchen commented 2 years ago

In PHP8, I get this deprecation warning about using the trim function with a null input:

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /.../art-of-wifi/unifi-api-client/src/Client.php on line 1042

Update the list_clients function to only trim and lowercase client_mac if it is not null.

malle-pietje commented 2 years ago

@djchen thanks for the contribution. This appears to be an undocumented change in behavior of the trim() function in PHP 8.X. I’ll apply this change asap and probably change it to check whether the variable is string.

malle-pietje commented 2 years ago

Manually added this in https://github.com/Art-of-WiFi/UniFi-API-client/releases/tag/v1.1.75 with some changes and added similar chacks in other methods as well as needed. Thanks!