Skip to content

Warning: compact(): Undefined variable $len in files.dynamic.php #2188

@Juniorbuka

Description

@Juniorbuka

Description

In the file manager, a PHP Warning is triggered because the variable $len is not initialized before being passed to the compact() function. This is especially problematic on PHP 8.x.

Location

File: [manager/actions/files.dynamic.php]
Line: 472 (call to compact)

Proposed Fix

Initialize $len before the condition:

+ $len = 0;
  if (strlen(MODX_BASE_PATH) < strlen($filemanager_path)) {
      $len--;
  }
...
- extract(ls($startpath, compact('len', ...

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