After install Composer Manager module I get next fatal error.
Fatal error: Call to undefined method Composer\Autoload\ClassLoader::setPsr4() in .../sites/all/vendor/composer/autoload_real.php on line 36

Comments

danylevskyi’s picture

Status: Active » Closed (works as designed)

I have Currency module installed. It defines it's composer.json file and stores vendor directory inside module's directory. The problem was in outdated autoloader. I've update it and all worked great.

Thanks for the great module!

basvredeling’s picture

I can't believe I spent 2 days trying to fix the autoloader of another module while all along it was currency!
Thanks for the suggestion.

basvredeling’s picture

I've asked Xano to add a small paragraph of text to the README.txt of the Currency module.
Also see: #2383825: Possible autoloader clash

dman’s picture

OMG. This took me hours as well - even after reading this issue and having what I thought was a clue.
I've not got currency in action.

In the end it was another drush module that's been using composer (there are quite a few of these around now).
For me it was drush_vagrant being long out of date (I only use it every few months).

Tracing it was really hard.
Its implementation of Classloader at ~/.drush/drush-vagrant/vendor/composer/ClassLoader.php was winning and failing.
This seems to be triggered by the drush module load orders or something, as it was pretty high in the list, being included before the Drupal bootstrap.

I could only trace it in the end by locating the named file vendor/composer/autoload_real.php and inserting some debug just before it died

 print_r(get_included_files());

That list (of way too many PHP files) identified the composer/ClassLoader.php that was the trigger for me.
This is something to do with the way composer in general expectes to be used, and something to do with the way that contrib modules are starting to do their own thing with composer dependencies. Hopefully this is just a transition period until either D7 contribs start using this module (?) or D8 modules start being distributed by composer proper (?)

Noting my diagnostic process here in case it saves the next victim half a day.

puidu’s picture

Thank you! You saved my day! I had the same problem. I updated currency module and all worked fine.