Issue Bug Closed

#82542Classloader information is not generating optimized class map for psr-4 when it is called the first time

Andreas Allacher 09/22/17, 14:38 updated 10/02/18, 10:55

Description

Currently the classloading information is not generating an optimized class map for psr-4 entries, if it is called the first time.
To reproduce the easiest way was with typo3_console (bit when doing some stuff manually it should be possible without):
  1. Have an Extension in typo3conf/ext that is NOT installed
  2. That install does need to have a composer.json with a “psr-4” autoload information and the corresponding directory needs to exist.
  3. Either call “typo3cms install:generatepackagestates” to install all existing extensions in typo3conf/ext or manually add the extension to PackageStates.php (do not use Extension Manager because that one doesn’t guarantee the dumpautoload only happens once)
  4. Dump autoload information using CLI.
    Either: typo3cms extension:dumpautoload
    or: typo3/cli_dispatch.phpsh extbase extension:dumpclassloadinginformation

Now the autoload_psr4.php is produced correctly.
However, autoload_classmap.php does not contain the classes of the previously NOT installed extension.
That only happens on a second call of “typo3cms extension:dumpautoload” or “typo3/cli_dispatch.phpsh extbase extension:dumpclassloadinginformation”

However, due to classloading performance the optimized map should always be generated even for PSR-4 entries, see:
https://getcomposer.org/doc/articles/autoloader-optimization.md

Reviews 2