WordPress.org

Ready to get started?Download WordPress

Forums

Tumblr Widget
[resolved] Error on line 295 (11 posts)

  1. testcricket
    Member
    Posted 3 years ago #

    I've been getting the following error

    Warning: Division by zero in /home/xxxxx/public_html/wp-content/plugins/tumblr-widget-for-wordpress/tumblr-widget.php on line 295 ...

    Tried to fix it but didn't seem to work. I found that line and it reads

    $old_width = $matches[1];
    $old_height = $matches[2];
    $new_height = $old_height; (this is line 295)

    The only thing I could see was that maybe it needed a number after old height similar to the others. So I tried that and it didnt work.

    I've deactivated it and deleted it while I wait to see what can be done to fix it.

    Cheers

    http://wordpress.org/extend/plugins/tumblr-widget-for-wordpress/

  2. gabrielroth
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks for the report. This is almost certainly some problem with your PHP installation. Are you running PHP5? (Users have had problems on PHP4.)

  3. testcricket
    Member
    Posted 3 years ago #

    Thanks for responding Gabriel - but I definitely have php5 on my server.

    Its 5.30 am here in Australia and I've been working all night so I'm about to head off for some zzzzzzzzz. I'll run a php.info check when I get up later today and see what it says. Not that I'm all that sure what to look for. LOL

  4. gabrielroth
    Member
    Plugin Author

    Posted 3 years ago #

    First try deleting and reinstalling the widget ... sometimes these things get a bit squirrelly. And feel free to post or send me a copy of your phpinfo(). (gabe.roth // gmail).

  5. menslow
    Member
    Posted 3 years ago #

    I'm also seeing this error. (running php 5 as well)

    This is line 295:
    $new_height = $old_height * ($video_width / $old_width );

    You're dividing by $old_width which is empty.

    The issue starts here on line 292 here: preg_match($pattern, $player, $matches);

    $matches isn't defined anywhere in your plugin so when you set $old_width = $matches[1], $old_width is still not set.

    Hope this helps.

    Best
    m

  6. menslow
    Member
    Posted 3 years ago #

    As a follow-up....

    A temporary solution is to comment out lines 289 through 298 so the exception doesn't occur. Looks like we lose some video width adjustment feature, but it's better than an error for now.

  7. gabrielroth
    Member
    Plugin Author

    Posted 3 years ago #

    Menslow, thanks for investigating. It seems like the data sent from Tumblr isn't always providing the width/height information the way it should ...

    ($matches is set by the preg_match function to the results of the grep search; if $matches[1] is empty, as it apparently is for you, the search isn't finding any matches for the search string in the Tumblr data.)

    Could you tell me the URL of the Tumblr you're seeing this error with so I can troubleshoot? Post here or email gabe.roth on the gmail. Thanks!

  8. menslow
    Member
    Posted 3 years ago #

  9. gabrielroth
    Member
    Plugin Author

    Posted 3 years ago #

    Just uploaded version 1.4.6, which should fix this issue. Let me know if it works.

  10. menslow
    Member
    Posted 3 years ago #

    That seems to have fixed it. Thanks Gabriel!

  11. gabrielroth
    Member
    Plugin Author

    Posted 3 years ago #

    Great—thanks for your help. Marking this resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic