WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Jetpack] Divide by zero error causing site to crash. (3 posts)

  1. jmckinnell
    Member
    Posted 2 years ago #

    Hello,

    We're having trouble with an error caused by the Polldady shortcode plugin within Jetpack.

    [Fri Sep 16 09:31:12 2011] [error] [client xx.xxx.xxx.xx] PHP Warning: Division by zero in /clients/xxxxx/www/wp-content/plugins/jetpack/modules/shortcode
    s/polldaddy.php on line 144

    Within 5-10 minutes after this error the site will crash. Trying to weed out possibilities and narrow down the cause of the crash.

  2. kitchin
    Member
    Posted 2 years ago #

    PHP should be able to handle that, do you really think it was causing a crash? Anyway, he ERROR was filling up my error_log with WANRINGS, along with another line, so I made these two change to my copy of polldaddy.php to stop it.

    // ...........
    
    	$keywords['generated'] = time();
    
    +	if ($keywords_xml) // stop a warning at line 17
    	foreach ( $keywords_xml->keyword as $keyword_xml ){
    
    // ...........
    
    	$keywords = array();
    
    -	$mod = ( $poll % ( count( $keywords ) - 1 ) );
    +	// stop a warning at line 144
    +	$mod = count( $keywords ) == 1 ? 0 : ( $poll % ( count( $keywords ) - 1 ) );
    
    	return '<a name= // ..............

    Probably good enough. There's still an odd "% -1" case.

  3. kitchin
    Member
    Posted 2 years ago #

    Forgot to edit my typos, sorry.

Topic Closed

This topic has been closed to new replies.

About this Topic