Skip to content

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

Open
@mbrodala

Description

@mbrodala

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions