aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Entry.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-05-25 16:02:52 +0200
committerGravatar GitHub <noreply@github.com> 2020-05-25 16:02:52 +0200
commite1ef88d8151f73f83c2c8813632bbef9371de5c5 (patch)
tree0548619dafa9a08d9431e300ccd8d9d3a64f10a0 /app/Models/Entry.php
parenta0f6e66e28ebba76e00cf4d3938ca53a35f89a0b (diff)
Fix memory leak when using lib_phpQuery (#3004)
* Fix memory leak when using lib_phpQuery This library keeps documents in static class, so it requires a special call to clean them. * Another unload
Diffstat (limited to 'app/Models/Entry.php')
-rw-r--r--app/Models/Entry.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index b5328df90..14eacbe78 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -401,6 +401,7 @@ class FreshRSS_Entry extends Minz_Model {
$refresh = preg_replace('/^[0-9.; ]*\s*(url\s*=)?\s*/i', '', trim($meta->getAttribute('content')));
$refresh = SimplePie_Misc::absolutize_url($refresh, $url);
if ($refresh != false && $refresh !== $url) {
+ phpQuery::unloadDocuments();
return self::getContentByParsing($refresh, $path, $attributes, $maxRedirs - 1);
}
}
@@ -408,7 +409,9 @@ class FreshRSS_Entry extends Minz_Model {
}
$content = $doc->find($path);
- return trim(sanitizeHTML($content->__toString(), $url));
+ $html = trim(sanitizeHTML($content->__toString(), $url));
+ phpQuery::unloadDocuments();
+ return $html;
} else {
throw new Exception();
}