Skip to content

Bigcommerce::getTime() doesn't validate store credentials and returns garbage #298

@luke8086

Description

@luke8086

Expected behavior

\Bigcommerce\Api\Client::getTime() should fail on invalid store credentials, as documented

Actual behavior

\Bigcommerce\Api\Client::getTime() uses $api_url instead of $api_path so it effectively requests https://api.bigcommerce.com/time, which doesn't check for any store credentials.

On top of that, that endpoint returns timestamp in milliseconds, and getTime() parses is as seconds, so it returns bogus DateTime object

Steps to reproduce behavior

Run without any prior setup:

>>> \Bigcommerce\Api\Client::getTime()
=>  DateTime @1718280499756 {#5814
      date: 56420-02-21 18:49:16.0 +00:00,
    }

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