dolibarr/htdocs/cron
evarisk-kilyan b22cbb9eed
Qual: Fix PHPStan warning (undefined variable $filter) in cron/list.php (#38771)
PHPStan level 9 (apstats config) reports at htdocs/cron/list.php:363:
"Variable $filter might not be defined."

$filter was only initialized inside the "if (empty($reshook))" Actions
block, but it is used unconditionally later to build the SQL WHERE clause.
When a hook intercepts the Actions section ($reshook not empty), $filter
stayed undefined. Initialize it with the other search criteria so it is
always defined.

As $filter is now always an array, the "is_array($filter)" guard becomes
redundant (it would raise a level 10 'always evaluate to true' warning),
so the condition is simplified to "count($filter) > 0". No behaviour change.

Co-authored-by: Muvikx <kilyan.cotten@epitech.eu>
2026-06-14 01:11:22 +02:00
..
admin add dolBuildUrl (#35664) 2025-10-17 02:31:07 +02:00
class Doc example 2026-05-29 12:16:42 +02:00
card.php Clean code 2026-05-04 09:54:31 +02:00
info.php NEW Show cron last result and output in info (#36028) 2025-11-05 22:37:13 +01:00
list.php Qual: Fix PHPStan warning (undefined variable $filter) in cron/list.php (#38771) 2026-06-14 01:11:22 +02:00