Fatal error requesting certain order by ID

Using the API I’m retrieving a list of orders based on id number of sorted by same:
$orders = $is->data()->query(‘Invoice’, 10, 0, [ ‘id’=>‘~>~100’ ], [‘id’], ‘id’, true );
I then process each using:
$order = $is->orders()->find( $order[‘id’] );

Occassionally I’m getting the API crashing because its not receiving a record from the server:
PHP Catchable fatal error: Argument 1 passed to Infusionsoft\Api\Rest\RestModel::fill() must be of the type array, null given, called in …/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php on line 200 and defined in …/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php on line 364

One such failure was that the invoice did not contain any invoice items. I situation I was able to guess and code around by making a test call prior.

Now it’s happening on another record and I can’t see why. The customer says his system is not showing an no invoice with ID 125, yet the query is returning data for ‘Invoice’ and ‘InvoiceItem’ tables for it. He thinks they were tests and could have been deleted, but I can’t see a way of an invoice is marked as deleted.

I’m guessing Api\Rest\RestModel::find() might be best checking if $data is NULL and throwing an exception instead of being an fatal error, but that would still leave me wondering what’s happened to invoice 125.

[18-Sep-2017 09:28:09 UTC] Array
(
[0] => Array
(
[LeadAffiliateId] => 0
[Description] => Shopping Cart
[PayStatus] => 1
[Synced] =>
[AffiliateId] => 0
[DateCreated] => DateTime Object
(
[date] => 2012-12-03 00:51:38.000000
[timezone_type] => 3
[timezone] => UTC
)

        [id] => 125
        [ContactId] => 6263
        [JobId] => 125
        [InvoiceType] => Online
    )

)

[18-Sep-2017 09:28:09 UTC] Array
(
[0] => Array
(
[Description] => Affiliate Test Product - £0.00 -
[id] => 157
[InvoiceId] => 125
[OrderItemId] => 155
)
)
[18-Sep-2017 09:28:09 UTC] PHP Catchable fatal error: Argument 1 passed to Infusionsoft\Api\Rest\RestModel::fill() must be of the type array, null given, called in …/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php on line 200 and defined in …/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php on line 364

@Kevin_Jones Can you create an issue on the Github Repo for the SDK about this error and we’ll get it fixed.