phergie / phergie-irc-plugin-react-twitter

Phergie plugin for displaying data from tweets
BSD 2-Clause "Simplified" License
0 stars 6 forks source link

Place is null or an object #12

Closed sitedyno closed 8 years ago

sitedyno commented 8 years ago

This tweet should cause bots using this plugin to crash: https://twitter.com/WyriHaximus/status/770004515080794113

In src/DefaultFormatter.php where $replacements is defined $tweet->place will be null or an object. I have changed it to $tweet->place->full_name.

sitedyno commented 8 years ago

Now checks if $tweet->place->full_name is set and added a test case for DefaultFormatter.

$tweet->geo is another possible gotcha. There is some explanation in the twitter docs about geo and they give an example, but if you look at some of the other geo stuff, it can be very complicated. I would lean towards removing it since it cannot be used in its current state. At the moment though any tweet w/ geo populated will crash the bot due to PHP Catchable fatal error: Object of class stdClass could not be converted to string in ...