Skip to content

Fix module sort comparator and drop Drupal 8/9 dead code in autoloader - #1036

Draft
mglaman wants to merge 1 commit into
audit/1c-latent-fixesfrom
audit/1d-autoloader-cleanup
Draft

Fix module sort comparator and drop Drupal 8/9 dead code in autoloader#1036
mglaman wants to merge 1 commit into
audit/1c-latent-fixesfrom
audit/1d-autoloader-cleanup

Conversation

@mglaman

@mglaman mglaman commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Part 5 of 9 in the legacy-code audit stack (on top of #1035).

What changed

  • The module sort comparator in DrupalAutoloader never returned a negative value and ignored its second operand, so test-module ordering was implementation-defined. Replaced with a valid comparator that reliably sorts _test extensions last, keeping their namespaces and services from taking precedence.
  • Removed the Drupal 8/9-only PhpUnit8\ClassWriter shim (the class was removed in Drupal 10) and the Drush 8 directory-depth branch (composer requires drush ^11 || ^12 || ^13).

Testing

Full suite, self-analysis, and phpcs are green.

🤖 Generated with Claude Code

@mglaman mglaman mentioned this pull request Aug 5, 2026
@mglaman
mglaman force-pushed the audit/1d-autoloader-cleanup branch from 8463308 to af47a4d Compare August 5, 2026 17:15
@mglaman
mglaman force-pushed the audit/1d-autoloader-cleanup branch from af47a4d to 822edb0 Compare August 5, 2026 19:13
The usort callback never returned a negative value, so test-module
ordering was implementation-defined. Replace it with a valid comparator
that sorts _test extensions last. Remove the PhpUnit8 ClassWriter shim
(removed in Drupal 10) and the Drush 8 directory-depth branch (composer
requires drush ^11 || ^12 || ^13).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mglaman
mglaman force-pushed the audit/1d-autoloader-cleanup branch from 822edb0 to 9bac357 Compare August 5, 2026 19:33
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.

1 participant