From 8edd44c03ee12fdee0682071b370f202f1bac10d Mon Sep 17 00:00:00 2001 From: pmleconte Date: Wed, 14 Feb 2024 16:54:57 +0100 Subject: [PATCH] 2.0.1 PHP error if category list is empty --- cgautoarchive.xml | 4 ++-- cgautoarchive_changelog.xml | 12 ++++++++++++ src/Extension/Cgautoarchive.php | 5 +++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cgautoarchive.xml b/cgautoarchive.xml index 0f9f17d..1389070 100644 --- a/cgautoarchive.xml +++ b/cgautoarchive.xml @@ -2,12 +2,12 @@ plg_task_cgautoarchive conseilgouz - 2024-02-13 + 2024-02-14 Copyright (C) 2024 ConseilGouz. All rights reserved. GNU General Public License version 3 or later; see LICENSE.txt pascal.leconte@conseilgouz.com www.conseilgouz.com - 2.0.0 + 2.0.1 PLG_TASK_CGAUTOARCHIVE_DESC ConseilGouz\Plugin\Task\CGAutoArchive diff --git a/cgautoarchive_changelog.xml b/cgautoarchive_changelog.xml index c5cba21..5cd52fa 100644 --- a/cgautoarchive_changelog.xml +++ b/cgautoarchive_changelog.xml @@ -1,4 +1,16 @@ + + cgautoarchive + plugin + task + 2.0.1 + + 14/02/2024 + + + PHP error if category list is empty + + cgautoarchive plugin diff --git a/src/Extension/Cgautoarchive.php b/src/Extension/Cgautoarchive.php index 77e25fa..7215ddc 100644 --- a/src/Extension/Cgautoarchive.php +++ b/src/Extension/Cgautoarchive.php @@ -1,7 +1,7 @@ task_choice == 'EOL') || ($params->task_choice == 'BOTH')) { $cats = $params->categories; + if (!is_array($cats)) $cats = []; try { $query = $db->getQuery(true); $query->update("#__content") ->set('state =2') ->where('publish_up <= DATE_SUB(now(),INTERVAL '.$params->sqlinterval.' '.$params->sqldatetype.') AND state IN (0, 1)'); - if (sizeOf($cats)) $query->where('catid in ('.implode(",",$cats).')'); + if (sizeof($cats)) $query->where('catid in ('.implode(",",$cats).')'); $db->setQuery($query); $db->execute(); } catch ( RuntimeException $e ) {