From e03b0bf5bd5968da11c740bf8a56549e59344a5c Mon Sep 17 00:00:00 2001 From: Petr Macek Date: Wed, 7 Oct 2026 08:46:39 +0200 Subject: [PATCH] infinite loop can occur if lowest id != 1 --- poller_intropage.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/poller_intropage.php b/poller_intropage.php index 9eb8fcd..3552726 100644 --- a/poller_intropage.php +++ b/poller_intropage.php @@ -132,14 +132,25 @@ * @return void */ function intropage_correct_load_order(): void { + $previous_id = null; + while (true) { - $intro_order = db_fetch_cell('SELECT id FROM plugin_config WHERE directory="intropage"'); + $id = db_fetch_cell('SELECT id FROM plugin_config WHERE directory = "intropage"'); - if ($intro_order > 1) { - api_plugin_moveup('intropage'); - } else { - break; + // Plugin no longer exists, or the query failed. + if (!is_numeric($id)) { + return; } + + $id = (int) $id; + + // Stop if the previous move made no progress. + if ($previous_id !== null && $id >= $previous_id) { + return; + } + + $previous_id = $id; + api_plugin_moveup('intropage'); } }