if (isset($_style['color']) && !empty($_style['color']) && array_sum($_style['color']) >= 0) {
             $style->color->setRGB($_style['color']['r'], $_style['color']['g'], $_style['color']['b']);
         }
         if (isset($_style['outlinecolor']) && !empty($_style['outlinecolor']) && array_sum($_style['outlinecolor']) >= 0) {
             $style->outlinecolor->setRGB($_style['outlinecolor']['r'], $_style['outlinecolor']['g'], $_style['outlinecolor']['b']);
         }
         if (isset($_style['width']) && floatval($_style['width']) > 0) {
             $style->width = floatval($_style['width']);
         }
         if (isset($_style['symbolname']) && !empty($_style['symbolname'])) {
             $style->symbolname = $_style['symbolname'];
         }
         if (isset($_style['size']) && floatval($_style['size']) > 0) {
             $style->size = floatval($_style['size']);
         }
         $style->free();
         unset($style);
     }
 }
 for ($i = 0; $i < $class->numstyles; $i++) {
     if (!isset($_class['style'][$i]) || empty($_class['style'][$i])) {
         $class->removeStyle($i);
     }
 }
 if (isset($_class['label'])) {
     $_label = $_class['label'];
     try {
         $label = $class->getLabel(0);
     } catch (MapScriptException $e) {
         $label = new labelObj();
         $class->addLabel($label);
        } else {
            $s->outlinecolor->setRGB(intval($_POST['outlinecolor']['r']), intval($_POST['outlinecolor']['g']), intval($_POST['outlinecolor']['b']));
        }
        $s->width = !empty($_POST['width']) ? floatval($_POST['width']) : -1;
        if (!empty($_POST['symbolname'])) {
            $s->symbolname = $_POST['symbolname'];
        } else {
            unset($s->symbolname);
        }
        $s->size = !empty($_POST['size']) ? floatval($_POST['size']) : -1;
        if (!empty($_POST['pattern'])) {
            $s->setPattern(explode(' ', $_POST['pattern']));
        } else {
            unset($s->pattern);
        }
        $s->free();
        unset($s);
        $c->free();
        unset($c);
        $l->free();
        unset($l);
        $map->save($mapfile);
        $map->free();
        unset($map);
        header('Location: layer-style-label.php?layer=' . $_GET['layer'] . '&class=' . $_GET['class'] . '&style');
        exit;
    } catch (MapScriptException $e) {
        $error = $e->getMessage();
    }
} else {
    if (isset($_POST['action']) && $_POST['action'] == 'save-style') {