Bug in export to Excel using convert service

Hi,
We are trying to export the data using Convertservice in PHP but there seems to be an issue when the header contents have ( in it . The header we have problem is “Estimated FY Fees ($MM)”. If I change this to “Estimated FY Fees [$MM)” export works fine. If the above said character is there ‘(’ in any of the headers, then the entire columns under it does not have any data at all. This happens even if I point the URL to yours
The PHP code sample is :

     require(SITE_ROOT . 'include/connector/convert.php');
    $config = new GridConfiguration();

    $setHeader = "...";
    $setColAlign = "center,left,....";
    $config->setHeader($setHeader);
    $config->setColAlign($setColAlign);
        $pdata = array("id" => 123, "firstname" => .. , "lastname" => .. , "email" => .., "survey" =>...,"fees" => ...);
        $data[] = $pdata;
        $convert = new ConvertService(
        "http://dhtmlxgrid.appspot.com/export/excel"
        );
        $conn = new GridConnector($mysqli, "MySQLi");
        $conn->set_config($config);
        $convert->excel();
        $columns = implode(",",array_keys($data[0]));
        $conn->render_array($data, "id", $columns);

The column is populated correctly when the header does not have ( in it. I checked in detail and the values disappear when it reaches the public function convert($conn, $out) in the convert.php (dumping $out showed blanks instead of the number supposed to be there for those particular column values). There are a total of 28 columns per row to export(and it happens in every row for that column). I’m attaching pic of the grid displayed / excel with issue and the data dump of the $out variable in the convert.php code(unfortunately the data has some client info that I cannot publish here so I have redacted it in the image, hope its ok)

Please can you suggest what could be wrong or what should I check? We are using the purchased version of dhtmlx
/*
Product Name: dhtmlxSuite
Version: 5.0
Edition: Professional

I noticed that there is some problem in the $conn object when I did its dump for the header which has the issue. Please see below dump of the $conn object

GridConnector Object
(
    [config:protected] => DataConfig Object
        (
            [id] => Array
                (
                    [db_name] => id
                    [name] => id
                )

            [relation_id] => Array
                (
                    [db_name] => 
                    [name] => 
                )

            [text] => Array
                (
                    [0] => Array
                        (
                            [db_name] => id
                            [name] => id
                        )

                    [1] => Array
                        (
                            [db_name] => firstname
                            [name] => firstname
                        )

                    [2] => Array
                        (
                            [db_name] => lastname
                            [name] => lastname
                        )

                    [3] => Array
                        (
                            [db_name] => email
                            [name] => email
                        )

                    [4] => Array
                        (
                            [db_name] => survey
                            [name] => survey
                        )

                    [5] => Array
                        (
                            [db_name] => lastmail
                            [name] => lastmail
                        )

                    [6] => Array
                        (
                            [db_name] => Evaluator Role
                            [name] => Evaluator Role
                        )

                    [7] => Array
                        (
                            [db_name] => NVS Division
                            [name] => NVS Division
                        )

                    [8] => Array
                        (
                            [db_name] => Brand Country
                            [name] => Brand Country
                        )

                    [9] => Array
                        (
                            [db_name] => Franchise
                            [name] => Franchise
                        )

                    [10] => Array
                        (
                            [db_name] => Brand
                            [name] => Brand
                        )

                    [11] => Array 
                        (
                            [db_name] => Indication
                            [name] => if brand has more than 1
                        )

                    [12] => Array
                        (
                            [db_name] => SOW Descriptor
                            [name] => SOW Descriptor
                        )

                    [13] => Array
                        (
                            [db_name] => Agency Type
                            [name] => Agency Type
                        )

                    [14] => Array
                        (
                            [db_name] => Agency Holding Company
                            [name] => Agency Holding Company
                        )

                    [15] => Array
                        (
                            [db_name] => Agency Name
                            [name] => Agency Name
                        )

                    [16] => Array
                        (
                            [db_name] => Agency Location City
                            [name] => Agency Location City
                        )

                    [17] => Array
                        (
                            [db_name] => Agency Location Country
                            [name] => Agency Location Country
                        )

                    [18] => Array
                        (
                            [db_name] => Estimated FY Fees
                            [name] => $MM) US
                        )

                    [19] => Array
                        (
                            [db_name] => Evaluation Year
                            [name] => Evaluation Year
                        )

                    [20] => Array
                        (
                            [db_name] => Role
                            [name] => Role
                        )

                    [21] => Array
                        (
                            [db_name] => XCEED Excel name
                            [name] => XCEED Excel name
                        )

                    [22] => Array
                        (
                            [db_name] => Signature Name
                            [name] => Signature Name
                        )

                    [23] => Array
                        (
                            [db_name] => Signature Title
                            [name] => Signature Title
                        )

                    [24] => Array
                        (
                            [db_name] => Signature Email
                            [name] => Signature Email
                        )

                    [25] => Array
                        (
                            [db_name] => status
                            [name] => status
                        )

                    [26] => Array
                        (
                            [db_name] => completed
                            [name] => completed
                        )

                    [27] => Array
                        (
                            [db_name] => completeddate
                            [name] => completeddate
                        )

                    [28] => Array
                        (
                            [db_name] => farthestpage
                            [name] => farthestpage
                        )

                )

            [data] => Array
                (
                    [0] => Array
                        (
                            [db_name] => id
                            [name] => id
                        )

                    [1] => Array
                        (
                            [db_name] => firstname
                            [name] => firstname
                        )

                    [2] => Array
                        (
                            [db_name] => lastname
                            [name] => lastname
                        )

                    [3] => Array
                        (
                            [db_name] => email
                            [name] => email
                        )

                    [4] => Array
                        (
                            [db_name] => survey
                            [name] => survey
                        )

                    [5] => Array
                        (
                            [db_name] => lastmail
                            [name] => lastmail
                        )

                    [6] => Array
                        (
                            [db_name] => Evaluator Role
                            [name] => Evaluator Role
                        )

                    [7] => Array
                        (
                            [db_name] => NVS Division
                            [name] => NVS Division
                        )

                    [8] => Array
                        (
                            [db_name] => Brand Country
                            [name] => Brand Country
                        )

                    [9] => Array
                        (
                            [db_name] => Franchise
                            [name] => Franchise
                        )

                    [10] => Array
                        (
                            [db_name] => Brand
                            [name] => Brand
                        )

                    [11] => Array
                        (
                            [db_name] => Indication
                            [name] => if brand has more than 1
                        )

                    [12] => Array
                        (
                            [db_name] => SOW Descriptor
                            [name] => SOW Descriptor
                        )

                    [13] => Array
                        (
                            [db_name] => Agency Type
                            [name] => Agency Type
                        )

                    [14] => Array
                        (
                            [db_name] => Agency Holding Company
                            [name] => Agency Holding Company
                        )

                    [15] => Array
                        (
                            [db_name] => Agency Name
                            [name] => Agency Name
                        )

                    [16] => Array
                        (
                            [db_name] => Agency Location City
                            [name] => Agency Location City
                        )

                    [17] => Array
                        (
                            [db_name] => Agency Location Country
                            [name] => Agency Location Country
                        )

                    [18] => Array
                        (
                            [db_name] => Estimated FY Fees
                            [name] => $MM) US
                        )

                    [19] => Array
                        (
                            [db_name] => Evaluation Year
                            [name] => Evaluation Year
                        )

                    [20] => Array
                        (
                            [db_name] => Role
                            [name] => Role
                        )

                    [21] => Array
                        (
                            [db_name] => XCEED Excel name
                            [name] => XCEED Excel name
                        )

                    [22] => Array
                        (
                            [db_name] => Signature Name
                            [name] => Signature Name
                        )

                    [23] => Array
                        (
                            [db_name] => Signature Title
                            [name] => Signature Title
                        )

                    [24] => Array
                        (
                            [db_name] => Signature Email
                            [name] => Signature Email
                        )

                    [25] => Array
                        (
                            [db_name] => status
                            [name] => status
                        )

                    [26] => Array
                        (
                            [db_name] => completed
                            [name] => completed
                        )

                    [27] => Array
                        (
                            [db_name] => completeddate
                            [name] => completeddate
                        )

                    [28] => Array
                        (
                            [db_name] => farthestpage
                            [name] => farthestpage
                        )

                )

        )

Please see dump of $config below before $conn->set_config($config); is set

GridConfiguration Object
(
    [headerDelimiter:protected] => ,
    [headerNames:protected] => Array
        (
            [0] => ID
            [1] => First Name
            [2] => Last Name
            [3] => E-mail
            [4] => Survey Link
            [5] => E-mail Sent
            [6] => Evaluator Role
            [7] => NVS Division
            [8] => Brand Country
            [9] => Franchise
            [10] => Brand
            [11] => Indication (if brand has more than 1)
            [12] => SOW Descriptor
            [13] => Agency Type
            [14] => Agency Holding Company
            [15] => Agency Name
            [16] => Agency Location City
            [17] => Agency Location Country
            [18] => Estimated FY Fees ($MM) USD
            [19] => Evaluation Year
            [20] => Role
            [21] => XCEED Excel name
            [22] => Signature Name
            [23] => Signature Title
            [24] => Signature Email
            [25] => Status
            [26] => Completed
            [27] => Completion Date
            [28] => Furthest Page Reached
        )

    [headerAttaches:protected] => Array
        (
        )

    [footerAttaches:protected] => Array
        (
        )

    [headerWidthsUnits:protected] => px
    [headerIds:protected] => 
    [headerWidths:protected] => 
    [headerTypes:protected] => 
    [headerAlign:protected] => Array
        (
            [0] => center
            [1] => left
            [2] => left
            [3] => center
            [4] => left
            [5] => left
            [6] => center
            [7] => center
            [8] => center
            [9] => center
            [10] => center
            [11] => center
            [12] => center
            [13] => center
            [14] => center
            [15] => center
            [16] => center
            [17] => center
            [18] => center
            [19] => center
            [20] => center
            [21] => center
            [22] => center
            [23] => center
            [24] => center
            [25] => center
            [26] => center
            [27] => left
            [28] => left
        )

    [headerVAlign:protected] => 
    [headerSorts:protected] => 
    [headerColors:protected] => 
    [headerHidden:protected] => 
    [headerFormat:protected] => 
    [convert_mode:protected] => 
)

Hi Guys,

I got it fixed with the change in the parse function of the DataConfig class in db_common.php as shown below. Will it affect anything else ? Please advise

	public function init($id,$fields,$extra,$relation){
		$this->id	= $this->parse($id,false);
		$this->text = $this->parse($fields,true,true); //BUGFIX for ( causing issue in header
                //print_r($this->text);exit;
		$this->data	= array_merge($this->text,$this->parse($extra,true));
		$this->relation_id = $this->parse($relation,false);
	}
	
	/*! parse configuration string
		
		@param key 
			key string from configuration
		@param mode
			multi names flag
		@return 
			parsed field name object
	*/
	private function parse($key,$mode,$nosplit=false){ //BUGFIX $nosplit added for preventing split for header??
		if ($mode){
			if (!$key) return array();
			$key=explode(",",$key);
			for ($i=0; $i < sizeof($key); $i++){
				$key[$i]=$this->parse($key[$i],false,$nosplit);
                        };
			return $key;
		}
                
		$key = ($nosplit==false)? explode("(",$key):array($key);//BUGFIX for ( causing issue while export in header
		$data=array("db_name"=>trim($key[0]), "name" => trim($key[0]));
		if (sizeof($key)>1)
			$data["name"]=substr(trim($key[1]),0,-1);
		return $data;		
	}