Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Geocode parameter bug on searchTweets() #47

@x-fran

Description

@x-fran

This is the code I'm playing with:

        $options = [
            # geocode element has the correct format according to Twitter documentation
            'geocode'=> '53.3242381,-6.3857848,1mi',
            'lang' => 'en',
            'locale' => 'IE',
            'result_type' => 'recent',
            'include_entities' => false,
        ];
        $res = $twitter->searchTweets("Leo Varadkar", $options)->getRawResponse();

I get this error: "geocode" must be of the format "latitude,longitude,radius".

Digging a bit I found bug in the Twitter class line 695.

case 'geocode':
/*line 695*/ if (!substr_count($value, ',') !== 2) {
         throw new Exception\InvalidArgumentException(
        '"geocode" must be of the format "latitude,longitude,radius"'
        );
    }

Should be if (substr_count($value, ',') !== 2) not if (!substr_count($value, ',') !== 2).
Please notice I removed the negation "!" in front of "substr_count" function.

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