PHP Can't divide by zero.

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
ThompsonE
Posts: 4
Joined: Mon Mar 18, 2013 12:47 pm

PHP Can't divide by zero.

Post by ThompsonE »

I've been having a heck of time trying to resolve an issue I've been having after a migration. I'm running PHP 5.3.25 and Cacti 8.8.a. When I ran the poller.php manually I kept getting the following errors which would prevent the poller from continuing and ultimately finishing which obviously resulted in no graphing.

PHP Warning: Division by zero in .../cacti/httpdocs/lib/graph_export.php on line 629
PHP Warning: Division by zero in .../cacti/httpdocs/lib/graph_export.php on line 634

The corresponding bit in that file is:

Code: Select all

			/* main graph page html */
			fwrite($fp_index, "<td align='center' width='" . round(100 / $classic_columns,0) . "%'><a href='graph_" . $graph["local_graph_id"] . ".html'><img src='graphs/thumb_" . $graph["local_graph_id"] . ".png' border='0' alt='" . $graph["title_cache"] . "'></a></td>\n");

			$i++;
			$k++;

			if ((($i % $classic_columns) == 0) && ($k < count($graphs))) {
				fwrite($fp_index, "</tr><tr>");
			}
  		}

I set a hard value for the first part and commented out the later and everything resumed to normal yet I have no idea what impact I made on anything else. Here is my resulted change.

Code: Select all

                        /* main graph page html */
                        fwrite($fp_index, "<td align='center' width='500px'><a href='graph_" . $graph["local_graph_id"] . ".html'><img src='graphs/thumb_" . $graph["local_graph_id"] . ".png' border='0' alt='" . $graph["title_cache"] . "'></a></td>\n");

                        $i++;
                        $k++;

                        /*if ((($i % $classic_columns) == 0) && ($k < count($graphs))) { */
                        /*      fwrite($fp_index, "</tr><tr>"); */
                        /*} */
                }

I'm hoping someone can give me a better fix for this and even pass it on for a fix in a later version.

Thank you.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: PHP Can't divide by zero.

Post by BSOD2600 »

Please file a bug, if it does not already exist - http://www.cacti.net/bugs.php
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest