StageBase::stageDirectoryExists() breaks on PreCreate

Created on 3 May 2023, over 1 year ago
Updated 4 May 2023, over 1 year ago

Problem/Motivation

There is a bug in StageBase::stageDirectoryExists(). The problem is that it calls getStageDirectory(), which gives you a path that may not exist if we're in the PreCreate phase of the stage life cycle.

Proposed resolution

The method should return the result of is_dir($this->getStageDirectory()). It should look, overall, like this:

    try {
      return is_dir($this->getStageDirectory());
    }
    catch (\LogicException) {
      return FALSE;
    }

A reasonable way to test this is to add a simple PreCreateEvent listener (using addTestEventListener()) which confirms that stageDirectoryExists() returns TRUE, and that the stage directory actually exists ($this->assertDirectoryExists()).

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024