tzsk/sms

array_merge(): Argument #1 is not an array

Closed this issue · 4 comments

array_merge(): Argument #1 is not an array

Hi,
Am getting the following error
On /opt/lampp/htdocs/laravel/vendor/tzsk/sms/src/Drivers/Textlocal.php line number 56

screenshot from 2018-01-30 00-01-25

Details

  • Laravel version 5.6
tzsk commented

@shiva-p17 Okay surely. I'll give it a look. But, it seems the problem is in the Request. No response is coming that's why it is not returning an array.

Getting the same error in laravel 5.5 can u have a look, please

To Fix array_merge(): Argument #1 is not an array

please remove array_merge() functionality on Textlocal.php send() as it's the case which arises response as error on when the mobile number to send SMS is registered as dnd on Trai.
Code has to be changed as mentioned below
public function send()
{
$numbers = implode(",", $this->recipients);

    $response = $this->client->request("POST", $this->settings->url, [
        "form_params" => [
            "username" => $this->settings->username,
            "hash" => $this->settings->hash,
            "numbers" => $numbers,
            "sender" => urlencode($this->settings->sender),
            "message" => $this->body,
        ],
    ]);

    $data = $this->getResponseData($response);

    return (object) $data;
}

Note: As I am using this package on my Laravel project when vendor folder get updated error arises so to fix this issue please change as soon as possible

tzsk commented

@shiva-p17 Please see this issue: #11 . Update your package and tell me if your issue is fixed. If not, I will re-open the bug.