Dear all,

when calling a standard tweet page (http://drupal.publicplan.de/tweets) we get a lot of "Trying to get property of non-object" errors, e.g. for the following files/methods:

  • twitter_views_handler_field_formatted_tweet->render() (Line 135 in /sites/all/modules/twitter/twitter_views_field_handlers.inc
  • include() (Line 10 in /sites/all/modules/twitter/tweet.tpl.php

Any clue? We are using PHP 5.4 ans all other installed modules work fine. Surprisingly our twitter messages display correctly after the error box.

Thanks
Christian

CommentFileSizeAuthor
#15 twitter-propertyNonObject-1944226-15.patch1.38 KBheddn
#10 twitter.inc_.patch532 bytesAnonymous (not verified)

Comments

JRZ-2’s picture

same here...

sstrigger’s picture

This seems to be an issue with older versions of MySQL. It fails and doesn't show the twitter message for me on 5.0.96 but works fine on 5.5.20. I believe it's because it's comparing a decimal value to a string. I replaced this code in twitter.inc and it seems to working okay.

function twitter_status_load($status_id) {
  return db_query("SELECT * FROM {twitter} WHERE twitter_id = :status_id",
           array(':status_id' => $status_id))->fetchObject();
}

with:

function twitter_status_load($status_id) {
  return db_query("SELECT * FROM {twitter} WHERE twitter_id = CAST(:status_id AS DECIMAL(20))",
           array(':status_id' => $status_id))->fetchObject();
}
satter9’s picture

Thanks for that! It worked well for me too.

Nils

etara’s picture

I'm getting the same error. I replaced that bit of code with what you pasted above, but then I still get the error (though much shorter) and with reference to a different line in tweet.tpl.php

sheldon rampton’s picture

sstrigger's hack in #2 worked for me.

Mat77’s picture

Thanks, hack #2 worked for me too.

Should be commited to trunk!

artworker’s picture

#2 hack worked for me also......Cheers!
Does anyone know if this will be included in the 7.x-6.x-dev version?

jvandooren’s picture

#2 worked for me as well. Is there a specific reason why the tweet_id is a decimal anyway?

sheldon rampton’s picture

@Ozmodiar: I think what has happened is that the total number of tweets in Twitter has gotten so large that the status IDs now contain more digits than some older versions of MySQL (and PHP) normally expect, so they have to be forced to expect the additional precision.

Anonymous’s picture

StatusFileSize
new532 bytes

Thanks sstrigger, spot on!

In order to get this committed I have attached a patch.
Please commit.

Anonymous’s picture

Version: 7.x-5.6 » 7.x-5.x-dev
Priority: Normal » Major
goldlilys’s picture

I hope this gets committed soon because this problem spit out so much errors while I was away and OMG bad for business to see so much errors in the page especially when twitter is on all of my site's pages. Thanks in advance.

Mat77’s picture

Agree with goldlilys, I updated the twitter module and got all these errors.
Took me some time to find out that I needed to apply this patch once again.

Thanks in advance to commit this on main version.

chrisfree’s picture

Patch in #10 fixed this issue for me.

heddn’s picture

Status: Active » Needs review
StatusFileSize
new1.38 KB

This patch picks up another numeric field in twitter_account_load() that also needed the CAST and thereby fixed a few more of the errors.

xurizaemon’s picture

Duplicated by #2055951: Interesting MySQL issue appears to cause randomish "twitter_views_handler_field_formatted_tweet->render()" errors, there's active discussion and similar patch there too.

Can consider the CAST solution in either issue once we have RTBC from someone who's tested that patch on non-MySQL platform.

Replacing the decimal ID with a string column might be a more sane fix?

leewillis77’s picture

I just posted a patch to #25055951 that resolves these issues for me. It changes the database structure to a more sane structure and should avoid these issues without the need for rewriting SELECT statements at all.

madbeerweek’s picture

#17 worked for me; remember to run update.php.

autopoietic’s picture

Issue summary: View changes

#17 works for me - https://drupal.org/node/1944226

thanks lee

xurizaemon’s picture