Skip to content

Null response from Infusionsoft causes Fatal Error #158

@brumiser1550

Description

@brumiser1550

The save() method on line 165 of vendor/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php cannot handle null responses from Infusionsoft resulting in an uncatchable fatal error.

I figured this out from trying to add a tag through the REST API where the tag category was not valid.

I feel like Infusionsoft should be returning some kind of message saying that the resource doesn't exist, not just a null response.

An easy solution would be to just say:

if(!$data){
    $data = [];
}
$this->fill($data);

because the fill method requires an array.

The Stack trace

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Infusionsoft\Api\Rest\RestModel::fill() must be of the type array, null given, called in /vendor/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php on line 177 and defined in /vendor/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php:391
Stack trace:
#0 /vendor/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php(177): Infusionsoft\Api\Rest\RestModel->fill(NULL)
#1 /vendor/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php(155): Infusionsoft\Api\Rest\RestModel->save()
#2 /process.php(918): Infusionsoft\Api\Rest\RestModel->create(Array)
#3 {main}
  thrown in /vendor/infusionsoft/php-sdk/src/Infusionsoft/Api/Rest/RestModel.php on line 391

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions