Support » Plugin: Tumblr Widget » [Plugin: Tumblr Widget] Error on line 295

  • Resolved testcricket


    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.


Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author gabrielroth


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

    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 check when I get up later today and see what it says. Not that I’m all that sure what to look for. LOL

    Plugin Author gabrielroth


    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).

    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.


    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.

    Plugin Author gabrielroth


    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!

    Plugin Author gabrielroth


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

    That seems to have fixed it. Thanks Gabriel!

    Plugin Author gabrielroth


    Great—thanks for your help. Marking this resolved.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Tumblr Widget] Error on line 295’ is closed to new replies.