PMC-1002 Error message: "mysql_free_result() couldnt fetch mysql_result" in appears in the _ERROR_ variable

This commit is contained in:
Roly Rudy Gutierrez Pinto
2019-10-11 07:49:19 -04:00
parent 026ca016cd
commit df45eb5af6
2 changed files with 10 additions and 3 deletions

View File

@@ -171,10 +171,12 @@ class MSSQLResultSet extends ResultSetCommon implements ResultSet
/** /**
* @see ResultSet::close() * @see ResultSet::close()
*/ */
function close() public function close()
{ {
if (extension_loaded('sqlsrv')) { if (extension_loaded('sqlsrv')) {
$ret = @sqlsrv_free_stmt($this->result); if (is_resource($this->result)) {
$ret = @sqlsrv_free_stmt($this->result);
}
} else { } else {
$ret = @mssql_free_result($this->result); $ret = @mssql_free_result($this->result);
} }

View File

@@ -98,7 +98,12 @@ class MySQLiResultSet extends ResultSetCommon implements ResultSet {
*/ */
public function close() public function close()
{ {
if ($this->result instanceof mysqli_result) { /**
* This is not a definitive solution because there are several behaviors
* reported to use the "mysqli_free_result()" function, see
* https://bugs.php.net/bug.php?id=63486
*/
if ($this->result instanceof mysqli_result && isset($this->result->lengths)) {
@mysqli_free_result($this->result); @mysqli_free_result($this->result);
} }
$this->fields = array(); $this->fields = array();