<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true" text="#000000" bgcolor="#FFFFFF">
Dear vtiger Team,<br>
<br>
In the way to prepare vtiger 6.1 to support php 5.5, I suggest to
review the database classes also.<br>
Here are some minor, easy to provide changes, that will not affect
any other codes, but the usability will increase.<br>
<br>
There is a file:<br>
<big><b>...\include\database\PearDatabase.php</b></big><br>
with the most used database class.<br>
<br>
And about line 526 there is a function <b>fetch_array</b>:<br>
<font color="#ff0000"> /* ADODB newly added. replacement for
mysql_fetch_array() */<br>
function fetch_array(&$result) {<br>
if($result->EOF) {<br>
//$this->println("ADODB fetch_array return null");<br>
return NULL;<br>
}<br>
$arr = $result->FetchRow();<br>
if(is_array($arr))<br>
$arr = array_map('<b>to_html</b>', $arr);<br>
return $this->change_key_case($arr);<br>
}</font><br>
<br>
As it shown, this function will convert all possible strings to
htmlentities during fetch [ array_map('to_html', $arr) ]. This
conversion in some of case unnecessary.<br>
This function would be more useful in the following form:<br>
<br>
/* ADODB newly added. replacement for mysql_fetch_array() */<br>
function fetch_array(&$result, <b>$encode=true</b>) {<br>
if($result->EOF) {<br>
//$this->println("ADODB fetch_array return null");<br>
return NULL;<br>
}<br>
$arr = $result->FetchRow();<br>
if(is_array($arr) && $encode)<br>
$arr = array_map('<b>to_html</b>', $arr);<br>
return $this->change_key_case($arr);<br>
}<br>
<br>
At this case htmlentities encoding can be disabled by $encode=false.<br>
<br>
Or in line 787:<br>
<font color="#ff0000"> function fetch_row(&$result,
$encode=true) {<br>
return $this->getNextRow($result);<br>
}</font><br>
<br>
It looks like it supports the disabling htmlentities encoding, but
inside the function it suppress the possibility.<br>
This function should be after correction:<br>
function fetch_row(&$result, $encode=true) {<br>
return $this->getNextRow($result, <b>$encode</b>);<br>
}<br>
<br>
The getNextRow supports the $encode parameter.<br>
function getNextRow(&$result, $encode=true){<br>
global $log;<br>
$log->info('getNextRow');<br>
if(isset($result)){<br>
$row =
$this->change_key_case($result->FetchRow());<br>
if($row && $encode&& is_array($row))<br>
return array_map('to_html', $row);<br>
return $row;<br>
}<br>
return null;<br>
}<br>
<br>
<br>
<div class="moz-signature">-- <br>
üdvözlettel:<br>
<br>
<b>Holbok István</b><br>
<br>
+3670-342-0900<br>
<b>e-mail:</b> <a class="moz-txt-link-abbreviated" href="mailto:holbok@gmail.com">holbok@gmail.com</a><br>
<b>SkyPe:</b> holboki<br>
<br>
</div>
</body>
</html>