Skip to content

PHP Fatal error: implode() expects array, string given in fail2ban.inc:161 (OMV8 / Debian 13) #41

Description

@LeNicoDesBois

Environment

  • OpenMediaVault: 8.0
  • Plugin version: openmediavault-fail2ban 8.0
  • OS: Debian GNU/Linux 13 Trixie (Raspberry Pi 4)
  • Fail2ban: 1.1.0-8

Bug description

When opening Diagnostics → Services → Fail2ban in the OMV web interface,
the following error is displayed:

Invalid RPC response. Please check the syslog for more information.

Error in syslog

PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /usr/share/openmediavault/engined/rpc/fail2ban.inc:161

Root cause

In fail2ban.inc line 161, implode() receives a string instead of an array:

// Buggy code (line 161)
$stats .= implode("\n", "No jail enabled");

// Fix
$stats .= implode("\n", ["No jail enabled"]);

Fix applied

sudo sed -i 's/implode("\\n", "No jail enabled")/implode("\\n", ["No jail enabled"])/' \
  /usr/share/openmediavault/engined/rpc/fail2ban.inc

This one-line fix resolves the issue immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions