From 14b401b52284216150647a6039eac8d9c22b2733 Mon Sep 17 00:00:00 2001 From: Mike Henry <henry_mike@bah.com> Date: Fri, 31 Mar 2023 12:32:59 -0400 Subject: [PATCH] Issue #80 add is_int($param) to $commentid loop --- lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.php b/lib.php index 9800f1c..1031060 100644 --- a/lib.php +++ b/lib.php @@ -425,12 +425,12 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc if ($filearea === 'post') { $commentid = 0; foreach ($args as $param) { - if ($DB->record_exists('pdfannotator_comments', ['id' => $param])) { + if (is_int($param) && $DB->record_exists('pdfannotator_comments', ['id' => $param])) { $commentid = $param; break; } } - + $fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/$commentid/$relativepath", '/'); if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) { //Annotations from other documents might have another contextid. -- GitLab