Skip to content

JsonException Syntax error in FileStorageDriver #378

@elephantux

Description

@elephantux

I have the following code:

$response = $this-chat->html($message)->send();
$rsBody = json_decode($response->body());
if (isset($rsBody->result->message_id)) {
    $this->chat->storage()->set('subscription_buttons_msg_id', $rsBody->result->message_id);
}

But in spite of checking and presence of number in variable ($rsBody->result->message_id) I get error:

Syntax error {"exception":"[object] (JsonException(code: 4): Syntax error at /var/www/5pclub/vendor/defstudio/telegraph/src/Storage/FileStorageDriver.php:39)
[stacktrace]
#0 /var/www/5pclub/vendor/defstudio/telegraph/src/Storage/FileStorageDriver.php(39): json_decode('', true, 512, 4194304)
#1 /var/www/5pclub/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(740): DefStudio\\Telegraph\\Storage\\FileStorag
#2 /var/www/5pclub/vendor/defstudio/telegraph/src/Storage/FileStorageDriver.php(39): rescue(Object(Closure), Array))

It seems to me that the error does not appear on every request. Because the storage is full of json files with saved values.

I can't figure out what this could be about. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions