Package: zabbix-frontend-php
Version: 1:1.8.2-1~bpo50+1
Severity: normal

I have mistakenly submitted this issue upstream first while it may affect only 
Debian:

https://support.zabbix.com/browse/ZBX-3297

Basically, importing certain templates yields PHP errors that are easily fixed, 
first documented in this forum:

http://www.zabbix.com/forum/showthread.php?t=16649

I have attached a patch that fixes this issue.

The symptoms are:

Fatal error: Undefined class constant 'resetErrors' in 
/var/www/zabbix/include/export.inc.php on line 859

And:

Undefined variable: 
template[/usr/src/zabbix-1.8.2/frontends/php/api/classes/class.ctemplate.php:1010]
Invalid argument supplied for 
foreach()[/usr/src/zabbix-1.8.2/frontends/php/api/classes/class.ctemplate.php:1183]
reset() [<a href='function.reset'>function.reset</a>]: Passed variable is not 
an array or 
object[/usr/src/zabbix-1.8.2/frontends/php/api/classes/class.ctemplate.php:1206]
Template [ cisco4948 ] already exists
Failed to update template

A.

-- System Information:
Debian Release: 5.0.7
  APT prefers stable
  APT policy: (500, 'stable'), (2, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.18-6-xen-amd64 (SMP w/1 CPU core)
Locale: LANG=fr_CA.UTF-8, LC_CTYPE=fr_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages zabbix-frontend-php depends on:
ii  apache2            2.2.9-10+lenny8       Apache HTTP Server metapackage
ii  apache2-mpm-prefor 2.2.9-10+lenny8       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  libjs-prototype    1.6.1-1~bpo50+1       JavaScript Framework for dynamic w
ii  libjs-scriptaculou 1.8.3-1~bpo50+1       JavaScript library for dynamic web
ii  php5               5.2.6.dfsg.1-1+lenny9 server-side, HTML-embedded scripti
ii  php5-gd            5.2.6.dfsg.1-1+lenny9 GD module for php5
ii  php5-mysql         5.2.6.dfsg.1-1+lenny9 MySQL module for php5
ii  ttf-dejavu-core    2.25-3                Vera font family derivate with add
ii  ucf                3.0016                Update Configuration File: preserv

Versions of packages zabbix-frontend-php recommends:
ii  mysql-server           5.1.49-1~bpo50+1  MySQL database server (metapackage
ii  mysql-server-5.1 [mysq 5.1.49-1~bpo50+1  MySQL database server binaries and
ii  zabbix-server-mysql    1:1.8.2-1~bpo50+1 network monitoring solution - serv

zabbix-frontend-php suggests no packages.

-- debconf information excluded
--- include/export.inc.php.orig 2010-12-15 13:08:26.000000000 -0500
+++ include/export.inc.php      2010-12-15 13:08:31.000000000 -0500
@@ -856,7 +856,7 @@
 
                                                        $result = 
CTemplate::update($host_db);
                                                        if(!$result){
-                                                               throw new 
APIException(1, CTemplate::resetErrors);
+                                                               throw new 
APIException(1, CTemplate::resetErrors());
                                                        }
                                                        
                                                        $options = array(
--- api/classes/class.ctemplate.php.orig        2010-12-15 13:07:30.000000000 
-0500
+++ api/classes/class.ctemplate.php     2010-12-15 13:07:55.000000000 -0500
@@ -1007,7 +1007,7 @@
 
                        foreach($templates as $tnum => $template){
                                $template['templates_link'] = 
isset($template['templates']) ? $template['templates'] : null;
-                               $template['templates'] = $template;
+                               $template['templates'] = (array) $template;
 
                                $result = self::massUpdate($template);
                                if(!$result) throw new 
APIException(ZBX_API_ERROR_PARAMETERS, 'Failed to update template');

Reply via email to