Package: cacti
Version: 1.1.31+ds1-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch
Dear Maintainer,
In Ubuntu, the attached patch was applied to achieve the following:
* debian/patches/php72_count_bc_changes.patch: PHP7.2 has deprecated
count() of non-Countable objects.
* debian/patches/update-cactisql.patch: Update cacti.sql for
readstring to community change.
Note that even with this change, the DEP8 tests fail on Ubuntu 18.04,
with:
Unexpected output in /var/log/cacti/cacti.log:
02/02/2018 16:40:07 - AUTOM8 ERROR: The Network ID: 1 is disabled. You must use
the 'force' option to force it's execution.
Which I think might be because we need to pass force to some URL or
check a network enabled box in the script?
Thanks for considering the patch.
*** /tmp/tmp6E1xYI/cacti_1.1.31+ds1-1ubuntu1.debdiff
diff -Nru cacti-1.1.31+ds1/debian/patches/php72_count_bc_changes.patch
cacti-1.1.31+ds1/debian/patches/php72_count_bc_changes.patch
--- cacti-1.1.31+ds1/debian/patches/php72_count_bc_changes.patch
1969-12-31 16:00:00.0 -0800
+++ cacti-1.1.31+ds1/debian/patches/php72_count_bc_changes.patch
2018-02-02 08:21:41.0 -0800
@@ -0,0 +1,106 @@
+Description: PHP7.2 has deprecated count() of non-Countable objects
+Author: Nishanth Aravamudan
+Origin: upstream,
https://github.com/Cacti/cacti/commit/202163bf7c8541f1b2827bdd62c584cc4d25124a.patch
+Bug: https://github.com/Cacti/cacti/issues/1040
+Last-Update: 2018-02-02
+
+--- cacti-1.1.31+ds1.orig/graphs_new.php
cacti-1.1.31+ds1/graphs_new.php
+@@ -757,7 +757,7 @@ function graphs() {
+ $num_input_fields = 0;
+ $num_visible_fields = 0;
+
+- if ($xml_array != false) {
++ if (sizeof($xml_array)) {
+ /* loop through once so we can find out
how many input fields there are */
+ foreach ($xml_array['fields'] as
$field_name => $field_array) {
+ if ($field_array['direction']
== 'input' || $field_array['direction'] == 'input-output') {
+--- cacti-1.1.31+ds1.orig/lib/api_automation.php
cacti-1.1.31+ds1/lib/api_automation.php
+@@ -760,7 +760,7 @@ function display_new_graphs($rule, $url)
+* for a dropdown selection
+*/
+ $xml_array = get_data_query_array($rule['snmp_query_id']);
+- if ($xml_array != false) {
++ if (sizeof($xml_array)) {
+ /* loop through once so we can find out how many input fields
there are */
+ foreach ($xml_array['fields'] as $field_name => $field_array) {
+ if ($field_array['direction'] == 'input' ||
$field_array['direction'] == 'input-output') {
+@@ -1898,7 +1898,7 @@ function global_item_edit($rule_id, $rul
+ $xml_array =
get_data_query_array($automation_rule['snmp_query_id']);
+ $fields = array();
+
+- if (sizeof($xml_array['fields'])) {
++ if (sizeof($xml_array) && sizeof($xml_array['fields'])) {
+ foreach($xml_array['fields'] as $key => $value) {
+ # ... work on all input fields
+ if (isset($value['direction']) &&
($value['direction'] == 'input' || $value['direction'] == 'input-output')) {
+--- cacti-1.1.31+ds1.orig/lib/data_query.php
cacti-1.1.31+ds1/lib/data_query.php
+@@ -27,7 +27,7 @@ function run_data_query($host_id, $snmp_
+
+ /* required for upgrading old versions of cacti */
+ if (!db_column_exists('host', 'poller_id')) {
+- return;
++ return false;
+ }
+
+ /* don't run/rerun the query if the host is down, or disabled */
+@@ -205,7 +205,7 @@ function get_data_query_array($snmp_quer
+
+ if (!file_exists($xml_file_path)) {
+ query_debug_timer_offset('data_query', "Could not find
data query XML file at '$xml_file_path'");
+- return false;
++ return array();
+ }
+
+ query_debug_timer_offset('data_query', "Found data query XML
file at '$xml_file_path'");
+@@ -1227,7 +1227,7 @@ function get_formatted_data_query_indexe
+ /* in case no unique index is available, fallback to first field in XML
*/
+ if ($sort_cache['sort_field'] == ''){
+ $snmp_queries = get_data_query_array($data_query_id);
+- if (isset($snmp_queries['index_order'])){
++ if (sizeof($snmp_queries) &&
isset($snmp_queries['index_order'])){
+ $i = explode(':', $snmp_queries['index_order']);
+ if (sizeof($i) > 0){
+ $sort_cache['sort_field'] = array_shift($i);
+@@ -1385,7 +1385,7 @@ function update_data_query_sort_cache($h
+