From 768c30832c895900f2dfe7b42ebcafd5916d53ed Mon Sep 17 00:00:00 2001 From: Daniel Wehner Date: Thu, 5 Dec 2019 14:54:57 +0000 Subject: [PATCH 1/3] Fix memory leak --- src/Parser/FMResultSet.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Parser/FMResultSet.php b/src/Parser/FMResultSet.php index 7f6d006..88fd334 100644 --- a/src/Parser/FMResultSet.php +++ b/src/Parser/FMResultSet.php @@ -82,6 +82,7 @@ public function parse($xml) ); } xml_parser_free($this->xmlParser); + unset($this->xmlParser); if (!empty($this->errorCode)) { return $this->fm->returnOrThrowException(null, $this->errorCode); } From de167601f5478cc7f2a35acff9e47e25ce8428e9 Mon Sep 17 00:00:00 2001 From: Romain Dunand Date: Wed, 1 Apr 2020 15:45:24 +0200 Subject: [PATCH 2/3] Allow Range limit to 0 Usefull to get foundcount without querying data --- src/Command/CompoundFind.php | 4 ++-- src/Command/Find.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Command/CompoundFind.php b/src/Command/CompoundFind.php index 69af0e8..cf22cb5 100644 --- a/src/Command/CompoundFind.php +++ b/src/Command/CompoundFind.php @@ -90,7 +90,7 @@ public function execute() ksort($this->requests); $totalRequestCount = count($this->requests); - + foreach ($this->requests as $precedence => $request) { $findCriterias = $request->findCriteria; $critCount = count($findCriterias); @@ -227,7 +227,7 @@ public function setRangeParams(&$params) if ($this->skip) { $params['-skip'] = $this->skip; } - if ($this->max) { + if ($this->max !== false) { $params['-max'] = $this->max; } } diff --git a/src/Command/Find.php b/src/Command/Find.php index 7059203..31389d9 100644 --- a/src/Command/Find.php +++ b/src/Command/Find.php @@ -237,7 +237,7 @@ protected function setRangeParams(&$params) if ($this->skip) { $params['-skip'] = $this->skip; } - if ($this->max) { + if ($this->max !== null) { $params['-max'] = $this->max; } } From 09abc56ce9dc41abf37c84d6a369347711ffe238 Mon Sep 17 00:00:00 2001 From: Romain Dunand Date: Wed, 1 Apr 2020 16:19:16 +0200 Subject: [PATCH 3/3] Fix invalid range parameter option (false) --- src/Command/CompoundFind.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/CompoundFind.php b/src/Command/CompoundFind.php index cf22cb5..8006a80 100644 --- a/src/Command/CompoundFind.php +++ b/src/Command/CompoundFind.php @@ -227,7 +227,7 @@ public function setRangeParams(&$params) if ($this->skip) { $params['-skip'] = $this->skip; } - if ($this->max !== false) { + if ($this->max !== null) { $params['-max'] = $this->max; } }