FuelSDK-PHP
FuelSDK-PHP copied to clipboard
[BUG] PHP 8: Deprecated function: trim(): Passing null to parameter of type string is deprecated.
Describe the bug
On PHP >= 8, there is ocurring this warning error:
Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in FuelSdk\ET_Client->createPayloadForOauth2() (line 392 of /app/vendor/salesforce-mc/fuel-sdk-php/src/ET_Client.php)
To Reproduce Try to authenticate or send a Data Extension row.
Expected behavior No throws PHP warning errors.
Possible solution:
Due to trim function on PHP +8 is expecting a string as parameter, use the null coalescing operator to provide a default value as appropriate.

Environment
- FuelSDK-PHP version: v1.4.0
- Lando v3.11.0
- PHP 8.1.14
- MacOS
The bug has the severity
- [ ] Minor: The defect affects minor functionality or non-critical data. It has an easy workaround.