Skip to content

Trying to access array offset on value of type null #118

@Axel-AMGHAR

Description

@Axel-AMGHAR
  • BotMan Version: 2.6.1
  • PHP Version: 7.4.25
  • Messaging Service(s):
  • Cache Driver:
  • FacebookDriver: 1.11.0

Description:

Error when calling chatbot with FacebookDriver:

local.ERROR: Trying to access array offset on value of type null {"exception":"[object] (ErrorException(code: 0): Trying to access array offset on value of type null at .......vendor/botman/driver-facebook/src/FacebookDriver.php:516)

So in FacebookDriver:
$facebookResponse->getContent() return nothing
$facebookResponse->getStatusCode() = 500

protected function throwExceptionIfResponseNotOk(Response $facebookResponse)
{
    if ($facebookResponse->getStatusCode() !== 200) {
        $responseData = json_decode($facebookResponse->getContent(), true);
        throw new FacebookException('Error sending payload: '.$responseData['error']['message']);
    }
}

Steps To Reproduce:

Facebook driver tutorial

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