From df4676daf1264897f59f2b7e3ac45d31ca866b25 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 19 Feb 2019 12:47:43 -0400 Subject: [PATCH] PMC-508 --- thirdparty/creole/drivers/mysqli/MySQLiResultSet.php | 4 +++- thirdparty/pear/DB/mysqli.php | 12 ++++++++++-- workflow/engine/classes/class.webdav.php | 6 +++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php b/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php index fecfd6361..32a9ddaac 100644 --- a/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php +++ b/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php @@ -98,7 +98,9 @@ class MySQLiResultSet extends ResultSetCommon implements ResultSet { */ public function close() { - @mysqli_free_result($this->result); + if (is_resource($this->result)) { + @mysqli_free_result($this->result); + } $this->fields = array(); } diff --git a/thirdparty/pear/DB/mysqli.php b/thirdparty/pear/DB/mysqli.php index 3c0fd1db4..7bd138855 100644 --- a/thirdparty/pear/DB/mysqli.php +++ b/thirdparty/pear/DB/mysqli.php @@ -379,7 +379,13 @@ class DB_mysqli extends DB_common # need to come up with different means for next line # since $result is object (int)$result won't fly... // unset($this->num_rows[(int)$result]); - return @mysqli_free_result($result); + + //for compatibility the method must return a boolean. + if (is_resource($result)) { + @mysqli_free_result($result); + return true; + } + return false; } // }}} @@ -902,7 +908,9 @@ class DB_mysqli extends DB_common // free the result only if we were called on a table if ($got_string) { - @mysqli_free_result($id); + if (is_resource($id)) { + @mysqli_free_result($id); + } } return $res; } diff --git a/workflow/engine/classes/class.webdav.php b/workflow/engine/classes/class.webdav.php index 4fd290379..d4d9503d6 100644 --- a/workflow/engine/classes/class.webdav.php +++ b/workflow/engine/classes/class.webdav.php @@ -944,6 +944,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * * @param string resource path to check for locks * @return bool true on success + * @link https://wiki.processmaker.com/index.php/WebDAV + * @deprecated */ public function checkLock($path) { @@ -959,7 +961,9 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server if ($res) { $row = mysqli_fetch_array($res); - mysqli_free_result($res); + if (is_resource($res)) { + mysqli_free_result($res); + } if ($row) { $result = array("type" => "write", "scope" => $row["exclusivelock"] ? "exclusive" : "shared", "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], "expires" => $row['expires']