Skip to content

Library classes not found in extensions with shared autoload prefix #667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mbrodala opened this issue Apr 4, 2025 · 0 comments
Open

Comments

@mbrodala
Copy link
Contributor

mbrodala commented Apr 4, 2025

What are you trying to achieve?

Run functional tests for a TYPO3 extension which uses the same psr-4 autoload prefix as a library package.

What do you get instead?

Frontend subrequests fail with an error:

Error: Class "Acme\Example\ClassFromLibraryPackage" not found

How to reproduce the issue?

Steps to reproduce the behavior:

  1. Have a TYPO3 extension package like acme/typo3-example with a psr-4 autoload prefix like Acme\\Example\\
  2. Require a library package like acme/example in that extension with exactly the same autoload prefix Acme\\Example\\
  3. Set up a usable TYPO3 site and use executeFrontendSubRequest() to perform a subrequest

Additional information you would like to provide?

The issue does not occur when actually installing the TYPO3 extension (which consequently pulls the library package).

For functional testing the issue can be avoided by adding another psr-4 entry to autoload-dev with Acme\\Example\\ and vendor/acme/example/src/ as path:

    "autoload": {
        "psr-4": {
            "Acme\\Example\\": "Classes/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Acme\\Example\\": "vendor/acme/example/src/",
            "Acme\\Example\\Tests\\": "Tests/"
        }
    },

Specify some data of the environment

  • TYPO3 testing framework version: 9.1.2
  • TYPO3 version: 11/12/13
  • PHP version: 8.1
mbrodala added a commit to pagemachine/typo3-matomo-tracking that referenced this issue Apr 4, 2025
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

No branches or pull requests

1 participant