"Check tweetbacks" URLs problem in event_twitter

Found a bug? Tell us!!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

During testing, a funny thing I found out. Seems related to the PHP version. On my work machine with php 5.3.3, the $item->results[0]->id is properly decoded using json_decode(). On my web machine with PHP 5.2.6, the bad X.yyyyE+Z format is used.

Output on work machine:

Code: Select all

REAL ID: 55187053255720960
SPRINTF ID: 55187053255720960
SPRINTF2 ID: 55187053255720960
STRING ID: 55187053255720960
STRVAL ID: 55187053255720960
(ID_STR): 55187053255720960

REAL ID: 55166449991421952
SPRINTF ID: 55166449991421952
SPRINTF2 ID: 55166449991421952
STRING ID: 55166449991421952
STRVAL ID: 55166449991421952
(ID_STR): 55166449991421952
output on web machine:

Code: Select all

REAL ID: 5.51870532557E+16
SPRINTF ID: 55187053255720960
SPRINTF2 ID: 55187053255720960
STRING ID: 5.51870532557E+16
STRVAL ID: 5.51870532557E+16
(ID_STR): 55187053255720960

REAL ID: 5.51664499914E+16
SPRINTF ID: 55166449991421952
SPRINTF2 ID: 55166449991421952
STRING ID: 5.51664499914E+16
STRVAL ID: 5.51664499914E+16
(ID_STR): 55166449991421952
Used script:

Code: Select all

<?php
$in = file_get_contents('http://search.twitter.com/search.json?q=http://tinyurl.com/3cbhcbx');
$item = json_decode($in);

$out = array();
foreach($item->results AS $result) {
    echo "REAL ID: " . $result->id . "\n";
    echo "SPRINTF ID: " . sprintf("%0.0f", $result->id) . "\n";
    echo "SPRINTF2 ID: " . sprintf("%17.0f", $result->id) . "\n";
    echo "STRING ID: " . (string)$result->id . "\n";
    echo "STRVAL ID: " . strval($result->id) . "\n";
    echo "(ID_STR): " . $result->id_str . "\n";
    echo "\n";
}

(BTW: As you can see in my result, no "+1" is needed).
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

I found a note on http://robotslacker.com/2010/11/twitter ... de-bigint/.

I've just committed a change so that "id_str" is preferred if set. Then the casting should be irrelevant...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by LazyBadger »

Yesterday check confirm fix as final. Danke!
Quis custodiet ipsos custodes?
bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by bernd_d »

Don't know it's similar problem, but i have it and it also occures with "check tweetbacks" :oops:

Tweetbacks (for twitter) are checkt and also found, but there is no correct output for text and link to the status.

Code: Select all

Found 1 tweets.<br>
<ul>
  <li>
    <a href="http://twitter.com/"></a>
    <br>
    <br>
    RT:0 <a href="http://twitter.com//status/63183973513314304">ID:63183973513314304</a><br>
    <a href="http://twitter.com//status/63183973513314304">comment url in blog</a><br>
    Time:,  
  </li>
</ul>
Link from check shows https://twitter.com//status/63183973513314304
but correct URL should be https://twitter.com/username/status/63183973513314304
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

Whats your twitter nick? Twitter often has trouble with underscores in usernames, if it occurs in a search API request...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by sonichouse »

I have the same issue, the check produces http://twitter.com//status/62838063956623362 however the correct URL is http://twitter.com/SteveForsterUK/statu ... 3956623362

I am using version: 1.33
Steve is occasionally blogging here
bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by bernd_d »

garvinhicking wrote:Whats your twitter nick? Twitter often has trouble with underscores in usernames, if it occurs in a search API request...
bauigel

No special characters, no numbers.


Serendipity 1.5.5 und PHP 5.2.12-nmm2 and microblogging-plugin 1.33.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

Are you all using the "Backtweets" API? As I read the code, this could be a cause...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by bernd_d »

garvinhicking wrote:Are you all using the "Backtweets" API?
Yes.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!
bernd_d wrote:
garvinhicking wrote:Are you all using the "Backtweets" API?
Yes.
I'm afraid you might need to disable this then...I bet they changed the output format of the JSON request, because "tweet_user_from" seems to no longer be set...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply