Vonage/vonage-php-sdk-core

Error during sending a message

j-cata opened this issue · 2 comments

When I try to send a message, the code is trying to assign an array to the property $authHandler of the Vonage\Client\APIResource class, but that property is expecting an object that implements the Vonage\Client\Credentials\Handler\HandlerInterface interface

Expected Behavior

The message should be sent.

Current Behavior

I got this error :
In APIResource.php line 352:
Cannot assign array to property Vonage\Client\APIResource::$authHandler of
type ?Vonage\Client\Credentials\Handler\HandlerInterface

Possible Solution

Steps to Reproduce (for bugs)

$basic = new Vonage\Client\Credentials\Basic($key, $token);
$vonage_client = new Vonage\Client($basic);
vonage_client->sms()->send(
    new Vonage\SMS\Message\Message(array(
        'to' => $phoneNumber,
        'from' => 'Test',
        'text' => $message
    ))
);

Your Environment

Symfony : 6.1.5
PHP : 8.1.11
vonage/client : 4.0.0

@j-cata should be fixed in #361 (Released in v4.0.4) thanks to @dragonmantank

Released as 4.0.4, thanks to @dragonmantank for hopping onto this outside of EMEA hours