J7mbo / twitter-api-php

The simplest PHP Wrapper for Twitter API v1.1 calls
MIT License
1.82k stars 802 forks source link

Invalid returned JSON data - error on line 315 #217

Closed Supertecnoboff closed 7 years ago

Supertecnoboff commented 7 years ago

Just wanted to let you know, the code on line 315 in the 'TwitterAPIExchange.php' document causes the output JSON object to be invalid. As a result JSON parsers (i.e.: an iPhone app), cannot parse the JSON object. For my personal project, I temporarily fixed this issue by commenting out the code which was giving the warning.

if (($error = curl_error($feed)) !== '')
        {
            curl_close($feed);

            /**
            throw new \Exception($error);
            */
        }
J7mbo commented 7 years ago

Hi! Thanks for the report. Typically this is a project that would be used in another PHP project. As a result, you would catch the exception, and then return your own JSON or do whatever you need with your own client.