Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-7976

Unlinking linked templates from parent template leaves items attached to parent template

XMLWordPrintable

      When I tried to unlink more than one linked template from parent template with 'Unlink and clear' button, items from these templates were still attached to given template. I've checked the code and seems that 'zbx_array_merge' is the problem.

      Here is the code:

      templates.php:		$_REQUEST['clear_templates'] = zbx_array_merge($_REQUEST['clear_templates'], $unlinkTemplates);
      

      I've chenged it to:

      $_REQUEST['clear_templates'] = zbx_flat_array_merge($_REQUEST['clear_templates'], $unlinkTemplates);
      

      and modified 'include/func.inc.php':

      --- func.inc.php.old	2014-03-20 16:09:14.000000000 +0400
      +++ func.inc.php	2014-03-20 16:08:21.637935103 +0400
      @@ -1338,6 +1338,21 @@
       	return $result;
       }
       
      +function zbx_flat_array_merge() {
      +        $args = func_get_args();
      +        $result = array();
      +        foreach ($args as &$array) {
      +                if (!is_array($array)) {
      +                        return false;
      +                }
      +        foreach ($array as $key => $value) {
      +                        array_push($result, $value);
      +                }
      +        }
      +
      +        return $result;
      +}
      +
       function uint_in_array($needle, $haystack) {
       	foreach ($haystack as $value) {
       		if (bccomp($needle, $value) == 0) {
      

            iivs Ivo Kurzemnieks
            nomoo Evgeny
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: