Skip to content

v0.6.0 release ZIP contains Jetpack classmap entries for omitted test files #283

Description

@rebeccahum

Summary

The v0.6.0 release ZIP contains Jetpack Autoloader classmap entries that point to files under tests/phpunit/, but the release ZIP excludes the tests/ directory.

This can cause fatal errors during normal WordPress web requests when another plugin checks for one of the mapped global classes.

Failure

For example, WPML calls:

class_exists( 'WP_CLI' );

The Jetpack Autoloader maps WP_CLI to:

$baseDir . '/tests/phpunit/Stubs/WpCliClasses.php'

That file is absent from the release ZIP, resulting in:

PHP Fatal error: Uncaught Error: Failed opening required
'.../mcp-adapter/tests/phpunit/Stubs/WpCliClasses.php'
in vendor/jetpack-autoloader/class-php-autoloader.php

This occurs during a regular web request; it does not require WP-CLI execution.

Reproduction

Download and extract the v0.6.0 release asset:

curl -L \
  https://github.com/WordPress/mcp-adapter/releases/download/v0.6.0/mcp-adapter.zip \
  -o mcp-adapter.zip

unzip mcp-adapter.zip

grep -n "WpCliClasses" \
  mcp-adapter/vendor/composer/jetpack_autoload_classmap.php

test -e mcp-adapter/tests/phpunit/Stubs/WpCliClasses.php

The classmap contains entries for WP_CLI and WP_CLI_Command, while the final command confirms the referenced file is absent.

The generated classmap also contains many other entries referencing omitted tests/phpunit/ files.

Expected behavior

Production autoload metadata should not reference files excluded from the release artifact. On a web request, class_exists( 'WP_CLI' ) should return false when WP-CLI is unavailable instead of causing a fatal error.

Suspected cause

The root package defines:

"autoload-dev": {
  "psr-4": {
    "WP\\MCP\\Tests\\": ["tests/phpunit/"]
  }
}

Jetpack Autoloader includes the root development autoload paths when generating its optimized classmap. The plugin ZIP then excludes tests/, leaving dangling classmap entries.

Suggested fix

Exclude tests from the production classmap:

"autoload": {
  "psr-4": {
    "WP\\MCP\\": "includes/"
  },
  "exclude-from-classmap": [
    "/tests/"
  ]
}

Then regenerate the release artifact, ideally as v0.6.1.

It would also help to add a release check that verifies every path in vendor/composer/jetpack_autoload_classmap.php exists inside the completed ZIP.

Impact

We temporarily rolled back to v0.5.0 because activating v0.6.0 caused site-wide fatal errors on installations using WPML.

Activity

  1. justlevine commented on Aug 13, 2026

    @justlevine
    Contributor

    Thanks so much @rebeccahum for reporting this and the suggested fix 🙌

  2. added a commit that references this issue on Aug 13, 2026
    23cb53e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions