php-twinfield / twinfield

PHP 7.3+ Library for using the Twinfield API.
https://accounting.twinfield.com/webservices/documentation/#/
Other
33 stars 77 forks source link

Using BrowseData with optional fields gives deprecated warnings on PHP 8.1 #222

Closed tomdrissen closed 1 year ago

tomdrissen commented 1 year ago

Some fields of the BrowseColumn (label, from and to) are optional. These are null in the class definition. In the BrowseData request the fields are converted to XML, but this will give an deprecated warning:

Deprecated: DOMDocument::createElement(): Passing null to parameter #2 ($value) of type string is deprecated

Possible solution: Don't add optional fields of BrowseColumn to the DOM structure.

rojtjo commented 1 year ago

I've opted to cast the null values to string since this matches the old behavior. Changes are included in v3.4.0.