IsraelOrtuno / pipedrive

Complete Pipedrive API client for PHP
MIT License
166 stars 58 forks source link

Undefined property: stdClass::$success #93

Closed wajahatalidgk closed 3 years ago

wajahatalidgk commented 3 years ago

(1/1) ErrorException Undefined property: stdClass::$success in Response.php line 53

at HandleExceptions->handleError(8, 'Undefined property: stdClass::$success', '\vendor\devio\pipedrive\src\Http\Response.php', 53, array())in Response.php line 53

at Response->isSuccess()in Request.php line 86 at Request->handleResponse(object(Response))in Request.php line 67 at Request->executeRequest('put', 'deals/17790', array())in Request.php line 53 at Request->performRequest('put', ':id', array())in Request.php line 134 at Request->__call('put', array(':id', array()))in Resource.php line 89 at Resource->update(17790, array()) ...

IsraelOrtuno commented 3 years ago

Be more explicit when creating issues, a simple copy paste does not help.

wajahatalidgk commented 3 years ago

Very simple exception require to handle... you just need to place a data existence check there... in Devio\Pipedrive\Http\Response

update the method;

public function isSuccess()
    {
        if (! $this->getContent()) {
            return false;
        }

        return $this->getContent()->success;
    }

with

public function isSuccess()
    {
        if (! $this->getContent()) {
            return false;
        }

        if(!property_exists($this->getContent(), 'success'))
            return false;

        return $this->getContent()->success;
    }
IsraelOrtuno commented 3 years ago

That looks nice, could you submit a PR?

IsraelOrtuno commented 3 years ago

Could you please provide steps to reproduce this? Not sure how to make this happen