[Vtigercrm-developers] Bug in the changeset #14217 - relating to the mysqli support
Holbok István
holbok at gmail.com
Sat Aug 23 20:41:29 GMT 2014
Hello Prasad,
There is an serious bug in the changeset #14217 relating to the mysqli
support.
There was a change in \include\database\PearDatabase.php in function
function disconnect().
http://trac.vtiger.com/cgi-bin/trac.cgi/changeset/14217
function disconnect() {
$this->println("ADODB disconnect");
if(isset($this->database)){
if($this->dbType == "mysql"){
mysql_close($this->database);
* } else if($this->dbType=="mysqli"){
mysqli_close($this->database);*
} else {
$this->database->disconnect();
}
unset($this->database);
}
}
The red lines shows the added, new lines. The command
*mysqli_close($this->database);* unfortunately wrong.
The right command would be: according to the
...\libraries\adodb\drivers\adodb-mysqli.inc.php line ~ 669
// returns true or false
function _close()
{
@mysqli_close($this->_connectionID);
$this->_connectionID = false;
}
---------------------------
*The right command* to close mysqli database is:
*mysqli_close($this->database->_connectionID);*
It really closes the database. The modification from the changeset
#14217 will not close the database but will give a worning:
Warning: mysqli_close() expects parameter 1 to be mysqli, object given
in ....\include\database\PearDatabase.php on line 875
And in the debugging/developing settings, /*vtiger */will echo this
warning message even to the JSON output of Vtiger_Response(), so all
AJAX responses could be broken. My AJAX in my CustomModule was broken
and I hunted the cause for 2 days and I have found it in the above
described.
Note: Analogous to the mysqli, may the mysql_close($this->database)
would be also wrong.
Kindest regards:
Istvan
--
üdvözlettel:
*Holbok István*
+3670-342-0900
*e-mail:* holbok at gmail.com
*SkyPe:* holboki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140823/93638405/attachment.html>
More information about the vtigercrm-developers
mailing list