plivo / plivo-php

Plivo PHP Helper Library
http://www.plivo.com
MIT License
110 stars 117 forks source link

Undefined index: added_on in Number.php construct #177

Closed ceswebmaster closed 4 years ago

ceswebmaster commented 4 years ago

v4.9 Out of nowhere without changing anything I started getting this when using $client->numbers->get('1234131234'):

function __construct(BaseClient $client, array $response, $authId)
    {
        parent::__construct($client);

        $this->properties = [
           'addedOn' => $response['added_on'],
            'alias' => $response['alias'],
            'application' => $response['application'],
            'carrier' => $response['carrier'],

Actually there are others also having trouble now, I haven't updated the API (I've been using 4.9). But I just tried removing that call and the next error I got was Undefined index: answer_time in vendor/plivo/plivo-php/src/Plivo/Resources/Call/Call.php when calling $client->calls->get($phoneUsage->messageUID)->properties

So lots of things failing. I did run a composer update shortly before this which upgraded the following (maybe there is a conflict): Package operations: 5 installs, 7 updates, 5 removals

ceswebmaster commented 4 years ago

I notice when I dump the $client it doesn't appear that I am able to authenticate anymore which is odd. Credentials haven't changed and I'm using laraval with a .env file. I tried to post a text message and that too isn't working which led me to that discovery. So I am thinking it's a conflicting issue with one of those updated packages as it was working fine before.

ceswebmaster commented 4 years ago

Closing this. There were a number of issues happening which stopped Plivo from working and all of them were related to a composer issue. After self-updating composer and clearing the cache and updating again everything worked.

ceswebmaster commented 4 years ago

Reopening... While this did work temporarily the rest client again stopped authenticating when calling new RestClient() Not sure why this is an issue now.

ceswebmaster commented 4 years ago

Tested with specific auth id and token and it worked, versus using them in the env file in Laravel. So the issue is with the environment variables not being passed in to the api.

ceswebmaster commented 4 years ago

Ok sorry for the round about. The issue with laravel not passing in the environmental variables was due to the caching needing to be cleared after running the composer update.