XeroAPI / xero-php-oauth2

Xero PHP SDK for oAuth 2 generated from Xero API OpenAPI Spec 3.0
MIT License
90 stars 64 forks source link

Incorrect duplicate test for \SplFileObject #280

Closed cjtaylor-adepteo closed 2 years ago

cjtaylor-adepteo commented 2 years ago

The \SplFileObject on line 311 blocks what I believe is the correct match on 314 and stops PDFs invoices being downloaded.

https://github.com/XeroAPI/xero-php-oauth2/blob/88e2d6bec113d0f0f4186ccd76180cf06bdec7e8/lib/AccountingObjectSerializer.php#L311

  311     ⦙   //} elseif (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {           
  312     ⦙   } elseif (in_array($class, ['\DateTime',  'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {                                 
  313     ⦙   ⦙   settype($data, $class);                                                                                                                                                                                 
  314     ⦙   ⦙   return $data;                                                                                                                                                                                           
  315     ⦙   } elseif ($class === '\SplFileObject') {  
eliissc commented 2 years ago

We are facing the same issue: the SDK doesn't return an SplFileObject anymore and we are unable to download the attachments. I did the same change directly in the SDK that the issue creator pointed out. I hope this will be fixed in the next version.

mbardelmeijer commented 2 years ago

See https://github.com/XeroAPI/xero-php-oauth2/pull/277 as well.

RettBehrens commented 2 years ago

looking to resolve with #281

pumpkinball commented 2 years ago

Fixed on latest release 2.14.0