From 7e42f5ed62945d0c5cda447c9744c58cdec68fc3 Mon Sep 17 00:00:00 2001 From: Adam Daley Date: Tue, 17 Mar 2026 15:49:39 +0000 Subject: [PATCH] Fixes for 2 code quality findings in `Tools` library (#3344) * Apply suggested fix to src/library/FOSSBilling/Tools.php from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to src/library/FOSSBilling/Tools.php from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- src/library/FOSSBilling/Tools.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/library/FOSSBilling/Tools.php b/src/library/FOSSBilling/Tools.php index f32e3b03c..28a2895b4 100644 --- a/src/library/FOSSBilling/Tools.php +++ b/src/library/FOSSBilling/Tools.php @@ -56,7 +56,7 @@ class Tools * @param int $length the length of the password to generate * @param bool|int $includeSpecial If special characters should be included. If 4 is passed, that's considered to be true (added for backwards compatibility). * - * @throws InformationException if it failed to generate a password meeting the requirements within 50 iterations + * @throws InformationException if it failed to generate a password meeting the requirements within 100 iterations */ public function generatePassword(int $length = 8, bool|int $includeSpecial = false): string { @@ -192,7 +192,8 @@ class Tools return []; } - $slots = (is_countable($ids) ? count($ids) : 0) ? implode(',', array_fill(0, is_countable($ids) ? count($ids) : 0, '?')) : ''; // same as RedBean genSlots() method + $count = is_countable($ids) ? count($ids) : 0; + $slots = $count ? implode(',', array_fill(0, $count, '?')) : ''; // same as RedBean genSlots() method $rows = $this->di['db']->getAll('SELECT id, title FROM ' . $table . ' WHERE id in (' . $slots . ')', $ids);