Package: cacti Version: 0.8.7e-1.1 Severity: normal Tags: patch Hi,
I'm receiving this error message every time I'm creating a graph from a custom template that does not create any new RRDs: | Notice: Undefined index: local_data_id in | /usr/share/cacti/site/graphs_new.php on line 202 | | Warning: Invalid argument supplied for foreach() in | /usr/share/cacti/site/graphs_new.php on line 202 | | Warning: Cannot modify header information - headers already sent by | (output started at /usr/share/cacti/site/graphs_new.php:202) in | /usr/share/cacti/site/graphs_new.php on line 330 For more information look at this discussion from cacti-user: http://sourceforge.net/mailarchive/forum.php?thread_name=796aed870912151256ne81ef85ocbc3cdf055685...@mail.gmail.com&forum_name=cacti-user The attached patch fixed the problem. Please include it in the next release. Thanks -- System Information: Debian Release: 5.0.3 APT prefers stable APT policy: (990, 'stable'), (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.26-2-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages cacti depends on: ii apache2 2.2.9-10+lenny6 Apache HTTP Server metapackage ii apache2-mpm-prefor 2.2.9-10+lenny6 Apache HTTP Server - traditional n ii dbconfig-common 1.8.39 common framework for packaging dat ii debconf [debconf-2 1.5.24 Debian configuration management sy ii libapache2-mod-php 5.2.6.dfsg.1-1+lenny4 server-side, HTML-embedded scripti ii libphp-adodb 5.05-1 The ADOdb database abstraction lay ii mysql-client-5.0 [ 5.0.51a-24+lenny2 MySQL database client binaries ii php5 5.2.6.dfsg.1-1+lenny4 server-side, HTML-embedded scripti ii php5-cli 5.2.6.dfsg.1-1+lenny4 command-line interpreter for the p ii php5-mysql 5.2.6.dfsg.1-1+lenny4 MySQL module for php5 ii php5-snmp 5.2.6.dfsg.1-1+lenny4 SNMP module for php5 ii rrdtool 1.3.1-4 Time-series data storage and displ ii snmp 5.4.1~dfsg-12 SNMP (Simple Network Management Pr ii ucf 3.0016 Update Configuration File: preserv Versions of packages cacti recommends: ii iputils-ping 3:20071127-1 Tools to test the reachability of ii logrotate 3.7.1-5 Log rotation utility ii mysql-server 5.0.51a-24+lenny2 MySQL database server (metapackage ii mysql-server-5.0 [mysq 5.0.51a-24+lenny2 MySQL database server binaries Versions of packages cacti suggests: pn php5-ldap <none> (no description available) -- debconf information: cacti/db/app-user: cacti cacti/mysql/admin-user: root cacti/upgrade-backup: true cacti/install-error: abort * cacti/webserver: None cacti/internal/reconfiguring: false cacti/mysql/method: unix socket cacti/remote/host: cacti/upgrade-error: abort cacti/dbconfig-upgrade: true cacti/internal/skip-preseed: true cacti/remote/newhost: cacti/purge: false cacti/passwords-do-not-match: cacti/dbconfig-remove: * cacti/dbconfig-install: true cacti/missing-db-package-error: abort cacti/database-type: mysql cacti/remove-error: abort cacti/db/dbname: cacti cacti/remote/port: cacti/dbconfig-reinstall: false
--- graphs_new.php_0.8.7e-1 2009-06-28 19:07:11.000000000 +0300 +++ graphs_new.php 2009-12-19 00:26:00.000000000 +0200 @@ -199,8 +199,10 @@ debug_log_insert("new_graphs", "Created graph: " . get_graph_title($return_array["local_graph_id"])); /* lastly push host-specific information to our data sources */ - foreach($return_array["local_data_id"] as $item) { - push_out_host($_POST["host_id"], $item); + if (!empty($return_array["local_data_id"])) { + foreach($return_array["local_data_id"] as $item) { + push_out_host($_POST["host_id"], $item); + } } }elseif ($current_form_type == "sg") { while (list($snmp_index, $true) = each($snmp_index_array)) { @@ -211,8 +213,10 @@ debug_log_insert("new_graphs", "Created graph: " . get_graph_title($return_array["local_graph_id"])); /* lastly push host-specific information to our data sources */ - foreach($return_array["local_data_id"] as $item) { - push_out_host($_POST["host_id"], $item); + if (!empty($return_array["local_data_id"])) { + foreach($return_array["local_data_id"] as $item) { + push_out_host($_POST["host_id"], $item); + } } } }