Skip to content

Possible bug #142

Open
Open
@zgelici

Description

@zgelici

Hi,

I get an issue with a part of code. i did some checks.

vendor\torann\geoip\src\Services\IPApi.php

Line 74 gives notice:

Notice: Trying to get property 'status' of non-object

current code:

if ($json->status !== 'success') {
            throw new Exception('Request failed (' . $json->message . ')');
        }

i think this will solve it:

if ($json && $json->status !== 'success') {
            throw new Exception('Request failed (' . $json->message . ')');
        }

I get the issue when i call this:

geoip()->getLocation($ip)['country']

i dont get the notice everytime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions