Subject: [Pkg-cacti-maint] Bug#860271: cacti: polling at a higher frequency than cron doesn't work due to php 7 deprecation of split()

From: Paul Gevers <[email-masked]>
Date: Thu, 13 Apr 2017 21:53:25 +0200

Package: cacti
Version: 0.8.8h+ds1-8
Severity: serious
Justification: breaks usability in valid and supported use case
Tags: pending patch

poller.php calls split() in two places, which is deprecated in PHP 7.
The code in question isn't run by default, but it causes problems when
the administrator configures cacti to poll data at a higher frequency
than the cron job that runs the poller. As the highest cron frequency is
once per minute, one will have to use this feature if higher resolution
is required.

-- System Information:
Debian Release: 9.0
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (200,
'experimental'), (200, 'testing'), (50, 'experimental'), (50,
'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages cacti depends on:
ii  dbconfig-mysql                              2.0.8
ii  debconf [debconf-2.0]                       1.5.60
ii  javascript-common                           11
ii  libapache2-mod-php                          1:7.0+49
ii  libapache2-mod-php7.0 [libapache2-mod-php]  7.0.16-3
ii  libjs-jquery                                3.1.1-2
ii  libjs-jquery-cookie                         11-3
ii  libjs-jquery-jstree                         3.3.3+dfsg1-1
ii  libjs-jquery-ui                             1.12.1+dfsg-4
ii  libjs-jquery-ui-theme-ui-lightness          1.12.1+dfsg-1
ii  libphp-adodb                                5.20.9-1
pn  perl:any                                    <none>
ii  php-cli                                     1:7.0+49
ii  php-mbstring                                1:7.0+49
ii  php-mysql                                   1:7.0+49
ii  php-snmp                                    1:7.0+49
ii  php-xml                                     1:7.0+49
ii  php7.0-cli [php-cli]                        7.0.16-3
ii  php7.0-mbstring [php-mbstring]              7.0.16-3
ii  php7.0-mysql [php-mysqlnd]                  7.0.16-3
ii  php7.0-snmp [php-snmp]                      7.0.16-3
ii  php7.0-xml [php-xml]                        7.0.16-3
ii  rrdtool                                     1.6.0-1+b2
ii  snmp                                        5.7.3+dfsg-1.7
ii  ucf                                         3.0036

Versions of packages cacti recommends:
ii  apache2 [httpd]                             2.4.25-3
ii  iputils-ping                                3:20161105-1
ii  logrotate                                   3.11.0-0.1
ii  mariadb-server-10.1 [virtual-mysql-server]  10.1.22-3

Versions of packages cacti suggests:
ii  moreutils  0.60-1
pn  php-ldap   <none>

-- debconf information:
  cacti/db/dbname: cacti
  cacti/remove-error: abort
  cacti/install-error: abort
  cacti/db/app-user: cacti@localhost
  cacti/upgrade-error: abort
  cacti/database-type: mysql
  cacti/internal/skip-preseed: false
* cacti/webserver: apache2
  cacti/mysql/method: Unix socket
* cacti/mysql/admin-user: root
  cacti/missing-db-package-error: abort
  cacti/dbconfig-reinstall: false
  cacti/internal/reconfiguring: false
  cacti/remote/port:
* cacti/dbconfig-install: true
  cacti/dbconfig-remove: true
  cacti/upgrade-backup: true
  cacti/remote/host: localhost
  cacti/remote/newhost:
  cacti/passwords-do-not-match:
  cacti/dbconfig-upgrade: true
  cacti/purge: false
Description: split() is deprecated in PHP 7, causing the code to fail
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/cacti/+bug/1662027
Bug-Debian: https://bugs.debian.org/
Source: https://github.com/Cacti/cacti/commit/6b5931130770cdfa5baa68c43a913dcabf1c3970

Index: cacti/poller.php
===================================================================
--- cacti.orig/poller.php
+++ cacti/poller.php
@@ -451,11 +451,9 @@ while ($poller_runs_completed < $poller_
 
 		/* sleep the appripriate amount of time */
 		if ($poller_runs_completed < $poller_runs) {
-			list($micro, $seconds) = split(' ', microtime());
-			$plugin_start = $seconds + $micro;
+			$plugin_start = microtime(true);
 			api_plugin_hook('poller_bottom');
-			list($micro, $seconds) = split(' ', microtime());
-			$plugin_end = $seconds + $micro;
+			$plugin_end = microtime(true);
 			if (($sleep_time - ($plugin_end - $plugin_start)) > 0) {
 				usleep(($sleep_time - ($plugin_end - $plugin_start)) * 1000000);
 			}

---

From: [email-masked] (Debian Bug Tracking System)
Date: Thu, 13 Apr 2017 20:51:06 +0000

Your message dated Thu, 13 Apr 2017 20:48:51 +0000
with message-id <[email-masked]>
and subject line Bug#860271: fixed in cacti 0.8.8h+ds1-9
has caused the Debian Bug report #860271,
regarding cacti: polling at a higher frequency than cron doesn't work due to php 7 deprecation of split()
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email-masked]
immediately.)

-- 
860271: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=860271
Debian Bug Tracking System
Contact [email-masked] with problems

Subject: cacti: polling at a higher frequency than cron doesn't work due to php 7 deprecation of split()
From: Paul Gevers <[email-masked]>
To: Debian Bug Tracking System <[email-masked]>
Date: Thu, 13 Apr 2017 21:53:25 +0200

Package: cacti
Version: 0.8.8h+ds1-8
Severity: serious

-- System Information:
Debian Release: 9.0

-- debconf information:
  cacti/db/dbname: cacti

Index: cacti/poller.php

Subject: Bug#860271: fixed in cacti 0.8.8h+ds1-9
From: Paul Gevers <[email-masked]>
To: [email-masked]
Date: Thu, 13 Apr 2017 20:48:51 +0000

Source: cacti
Source-Version: 0.8.8h+ds1-9

We believe that the bug you reported is fixed in the latest version of
cacti, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email-masked],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Paul Gevers <[email-masked]> (supplier of updated cacti package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email-masked])

Format: 1.8
Date: Thu, 13 Apr 2017 22:05:30 +0200
Source: cacti
Binary: cacti
Architecture: source
Version: 0.8.8h+ds1-9
Distribution: unstable
Urgency: medium
Maintainer: Cacti Maintainer <[email-masked]>
Changed-By: Paul Gevers <[email-masked]>
Description:
 cacti      - web interface for graphing of monitoring systems
Closes: 860271
Changes:
 cacti (0.8.8h+ds1-9) unstable; urgency=medium
 .
   * Add enable_faster_polling_than_cron.patch to replace the use of the
     deprecated split() function (Closes: #860271)
Checksums-Sha1:
 3ae859537daa0731d5d008c460ab0d2ee921d4fc 1634 cacti_0.8.8h+ds1-9.dsc
 54adb3262c74629b1081eb91ad262dd251784d61 48736 cacti_0.8.8h+ds1-9.debian.tar.xz
Checksums-Sha256:
 4c831f5826b74c13a894a21f54ea8ba192dcd81d0f48cc33c89a09f4cae74521 1634 cacti_0.8.8h+ds1-9.dsc
 67427f8ed3f958bf5fb060995775ebed1ae5de0cd17b04e4dad8f30e86b66b1e 48736 cacti_0.8.8h+ds1-9.debian.tar.xz
Files:
 0908982e2a4968d265c5120a0409ae78 1634 web extra cacti_0.8.8h+ds1-9.dsc
 1311650451f4268d344b443744b19b4f 48736 web extra cacti_0.8.8h+ds1-9.debian.tar.xz