Bug #65688

Using TYPO3_COMPOSER_AUTOLOAD requires post-autoload-dump script in project composer.json

Added by Alexander Stehlik about 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-03-12
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I tested the new class loading with TYPO3_COMPOSER_AUTOLOAD enabled.

Everything works fine, unless you do not have extensions that use legacy class names in their ext_localconf.php files. Those classes will not be found.

What solved the problem for me was adding the post-autoload-dump setting the composer.json file of my project:

"scripts": {
    "post-autoload-dump": "Helhum\\ClassAliasLoader\\Composer\\ClassAliasGenerator::generateAliasMap" 
},

In my point of view it makes sense, that this script configuration needs to be added, otherwise the alias map will not be available in the autoloader of composer.

But this should be documented.


Related issues

Related to TYPO3 Core - Task #64361: Improve class loading performance Closed 2015-01-19

Associated revisions

Revision 2a432333 (diff)
Added by Helmut Hummel about 5 years ago

[BUGFIX] Simplify composer class alias loader usage

The class alias loader package was changed to be a composer plugin.
By that, the script section can be removed again.

In addition we change the requirement to the minimum version which
contains the plugin conversion.

Releases: 6.2, master
Resolves: #65688
Change-Id: I2ca1eee56e9a3f9e1f538ab95d9a01544ea98c95
Reviewed-on: http://review.typo3.org/38956
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

Revision 77ec9425 (diff)
Added by Helmut Hummel about 5 years ago

[BUGFIX] Simplify composer class alias loader usage

The class alias loader package was changed to be a composer plugin.
By that, the script section can be removed again.

In addition we change the requirement to the minimum version which
contains the plugin conversion.

Releases: 6.2, master
Resolves: #65688
Change-Id: I2ca1eee56e9a3f9e1f538ab95d9a01544ea98c95
Reviewed-on: http://review.typo3.org/38955
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

History

#1 Updated by Fabien Udriot about 5 years ago

  • Description updated (diff)

+1

Thanks Alexander for posting your solution. I run into the same problem and adding the post-autoload-dump solved the case.

What the log was saying:


PHP Catchable fatal error:  Argument 1 passed to TYPO3\CMS\Core\Core\ClassAliasMap::injectComposerClassLoader() must be an 
instance of Helhum\ClassAliasLoader\Composer\ClassAliasLoader, instance of Composer\Autoload\ClassLoader given, called in 
/var/www/typo3_src/typo3/sysext/core/Classes/Core/Bootstrap.php on line 420 and defined in 
/var/www/typo3_src/typo3/sysext/core/Classes/Core/ClassAliasMap.php on line 87

#2 Updated by Gerrit Code Review about 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38955

#3 Updated by Gerrit Code Review about 5 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38956

#4 Updated by Gerrit Code Review about 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38955

#5 Updated by Gerrit Code Review about 5 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38956

#6 Updated by Helmut Hummel about 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF