Skip to content

WP-CLI logger setup crashes with undefined FS_CHMOD_DIR #1320

Description

@pirate-bot

Summary

Feedzy task scheduling can terminate with Error: Undefined constant "FS_CHMOD_DIR" while initializing its log directory in a WP-CLI request.

Expected behavior: scheduled-task initialization creates or accesses the logging directory without a fatal error.

Actual behavior: when the logger directory creation path is reached and the filesystem permission constant is unavailable, initialization throws an uncaught error.

Impact: affected command-line WordPress runs cannot complete Feedzy task scheduling or subsequent bootstrap work in that request.

Customer context

  • Product / area: Feedzy RSS Feeds logging and scheduled-task initialization
  • Version: 5.2.8
  • Environment: WordPress 7.1, PHP 8.3.33, WP-CLI request context
  • Integration / third party: Not applicable
  • Reported error / symptom: Error: Undefined constant "FS_CHMOD_DIR"
  • Impact: Telemetry recorded 2 occurrences across 2 sites between 2026-08-23 and 2026-08-25.

Reproduction notes

Reported production path:

  1. Run WordPress through WP-CLI with Feedzy 5.2.8.
  2. Reach Feedzy init task scheduling, which creates the logger for email-report scheduling.
  3. Ensure the Feedzy log directory does not already exist.
  4. In an environment where FS_CHMOD_DIR is unavailable at this point, logger setup throws Undefined constant "FS_CHMOD_DIR".

The final filesystem precondition is confirmed by production telemetry and source inspection but has not been locally reproduced.

Diagnosis

Conclusion

Production telemetry places the uncaught error at the logger directory creation call. In the inspected 5.2.8 source, Feedzy_Rss_Feeds_Log::setup_log_directory() directly evaluates FS_CHMOD_DIR only when the log directory is absent, with no check that the constant exists. This matches the reported error and stack trace. The exact external condition under which WordPress leaves this constant undefined was not runtime-reproduced locally.

Where this likely occurs

  • includes/admin/feedzy-rss-feeds-log.phpFeedzy_Rss_Feeds_Log::__construct() lines 208-212 initializes the filesystem and immediately enters log-directory setup.
  • includes/admin/feedzy-rss-feeds-log.phpFeedzy_Rss_Feeds_Log::init_filesystem() lines 233-242 invokes WP_Filesystem() and assigns the global filesystem object without checking its result or the permission constants.
  • includes/admin/feedzy-rss-feeds-log.phpFeedzy_Rss_Feeds_Log::setup_log_directory() lines 250-258 evaluates FS_CHMOD_DIR at line 255, followed by FS_CHMOD_FILE for generated files.
  • includes/admin/feedzy-rss-feeds-task-manager.phpFeedzy_Rss_Feeds_Task_Manager::schedule_tasks() lines 53-60 calls schedule_email_report(), which obtains the logger at lines 68-70; this aligns with the telemetry stack.
  • Tag v5.2.8 contains the same unguarded logger code. Git pickaxe identifies logger introduction commit baea309 (feat: add the new logger (#1124)); no later version boundary proving a regression was found.

Engineering notes

The crash belongs to the free Feedzy repository, not the bundled Themeisle SDK; telemetry explicitly marks the crash as outside SDK code and the implicated logger is in this repository. The failing branch is conditional on feedzy-logs not already existing. The stack shows the logger is instantiated during the init-time scheduling flow in WP-CLI, before the email-report setting can short-circuit later scheduling. The behavior of WordPress filesystem initialization in this specific CLI environment was not verified from WordPress core source in the workspace.

Test coverage status

tests/test-log.php lines 74-82 constructs the logger in test setup, and lines 398-492 reconstruct it for logger settings cases. tests/test-scheduler.php lines 42-65 covers generic scheduler behavior. tests/e2e/specs/logger.spec.js lines 14-58 covers logger settings and displayed logs. No relevant coverage was found during inspection for an absent log directory with unavailable FS_CHMOD_DIR or FS_CHMOD_FILE, failed or partial filesystem initialization, or WP-CLI scheduling through this path.

What to verify or explore next

  • May be worth reproducing on a clean WordPress 7.1 and PHP 8.3 WP-CLI installation after removing the Feedzy log directory.
  • If reproducible, checking the availability of filesystem permission constants immediately before logger setup would establish the environment precondition.
  • Running the logger PHPUnit suite and a WP-CLI bootstrap/task-scheduling check would cover the reported request path.

Unknowns / follow-up

  • The telemetry does not state whether the feedzy-logs directory was absent, though the evaluated line is within that branch.
  • No local runtime environment was used to establish which filesystem configuration leaves the reported constant undefined.

Confidence

Confidence: 95/100

Production telemetry records the same uncaught FS_CHMOD_DIR error on two sites running Feedzy 5.2.8 under WP-CLI. The tagged release directly evaluates that undefined constant while creating the logger directory, matching the reported file, line, and call path.

Crash telemetry

Occurrences 2
Distinct sites 2
First seen 2026-08-23 01:45 UTC
Last seen 2026-08-25 22:45 UTC
Crash location product:includes/admin/feedzy-rss-feeds-log.php:255
Request context cli
Inside Themeisle SDK no
Product versions 5.2.8
WP versions 7.1
PHP versions 8.3.33
SDK versions 3.3.58

Source: automated crash report — feedzy-rss-feeds, fingerprint f3dc9ea4e26495238e5a4e2df7278f80
Generated by bug-report-triage (ID: bug-report-triage_6a8e814248fcb1.67259648)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions