diff --git a/thirdparty/creole/drivers/mssql/MSSQLResultSet.php b/thirdparty/creole/drivers/mssql/MSSQLResultSet.php index b66008179..f9c2f1330 100644 --- a/thirdparty/creole/drivers/mssql/MSSQLResultSet.php +++ b/thirdparty/creole/drivers/mssql/MSSQLResultSet.php @@ -171,10 +171,12 @@ class MSSQLResultSet extends ResultSetCommon implements ResultSet /** * @see ResultSet::close() */ - function close() + public function close() { if (extension_loaded('sqlsrv')) { - $ret = @sqlsrv_free_stmt($this->result); + if (is_resource($this->result)) { + $ret = @sqlsrv_free_stmt($this->result); + } } else { $ret = @mssql_free_result($this->result); } diff --git a/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php b/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php index 4a2f104c6..cb8dd29b8 100644 --- a/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php +++ b/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php @@ -98,7 +98,12 @@ class MySQLiResultSet extends ResultSetCommon implements ResultSet { */ 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); } $this->fields = array();