FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Restore Flight::path() autoloading broken in 3.19 by ambrose5773 · Pull Request #725 · flightphp/core · GitHub

/ core Public

Restore Flight::path() autoloading broken in 3.19 - #725

Merged
n0nag0n merged 2 commits into
masterfrom
restore-path-autoloader
Sep 2, 2026
Merged

n0nag0n merged 2 commits into
masterfrom
restore-path-autoloader

Conversation

Copy link
Copy Markdown
Contributor

Why

Flight::path() stopped loading namespaced app classes in 3.19.0 / 3.19.1. 3.18.3 still works. flightphp/docs hit this on app\middleware\... after bumping core.

This breaks a Flight rule: upgrades should not break the project.

Cause

PR #709 (autoload-rework):

  1. composer.json dropped "files": ["flight/autoload.php"], so Composer never includes the file that calls Loader::autoload().
  2. flight/autoload.php started returning when vendor/autoload.php exists, so a Composer install never registers Loader::loadClass().

Flight::path() still calls Loader::addDirectory(). Nothing is listening.

Fix

  • Put the files autoload back. Keep classmap + flight\\ PSR-4.
  • Always call Loader::autoload(true, [dirname(__DIR__)]). Do not return early just because Composer is present.
  • Regression test: Flight::path() then class_exists(\app\middleware\Something::class) for a class that is not in Composer PSR-4.

After merge, docs can unpin ^3.15 <3.19 once there is a 3.19.2 (or whatever you tag).

PR 709 dropped the Composer files entry for flight/autoload.php and that file returned early when vendor/autoload.php existed, so Loader::autoload() never registered. path() still added directories; namespaced app classes never loaded. Upgrades must not break that.
files autoload still registers Loader::autoload() so Flight::path() works. Composer PSR-4 already loads flight\*. Reset leftover path() dirs in AutoloadTest so LoaderTest can assert the exact list.
n0nag0n merged commit f617b5c into master Sep 2, 2026
21 checks passed
n0nag0n deleted the restore-path-autoloader branch September 2, 2026 02:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL