lib/IniModifier.php
public function renameSection($oldName, $newName)
    {
        if (!isset($this->content[$oldName])) {
            return false;
        }

        if (isset($this->content[$newName])) {
            return $this->mergeSection($oldName, $newName);
        }

        $newcontent = array();
        foreach ($this->content as $section => $values) {
            if ((string) $oldName == (string) $section) {
                if ($section == '0') {
                    $newcontent[0] = array();
                }
                if ($values[0][0] == self::TK_SECTION) {
                    $values[0][1] = '['.$newName.']';
                } else {
                    array_unshift($values, array(self::TK_SECTION, '['.$newName.']'));
                }
                $newcontent[$newName] = $values;
            } else {
                $newcontent [$section] = $values;
            }
        }
        $this->content = $newcontent;
        $this->modified = true;

        return true;
    }
public function renameSection($oldName, $newName)
    {
        if (!isset($this->content[$oldName])) {
            return false;
        }

        if (isset($this->content[$newName])) {
            return $this->mergeSection($oldName, $newName);
        }

        $newcontent = array();
        foreach ($this->content as $section => $values) {
            if ((string) $oldName == (string) $section) {
                if ($section == '0') {
                    $newcontent[0] = array();
                }
                if ($values[0][0] == self::TK_SECTION) {
                    $values[0][1] = '['.$newName.']';
                } else {
                    array_unshift($values, array(self::TK_SECTION, '['.$newName.']'));
                }
                $newcontent[$newName] = $values;
            } else {
                $newcontent [$section] = $values;
            }
        }
        $this->content = $newcontent;
        $this->modified = true;

        return true;
    }
rename a section.