Page MenuHomePhabricator

Composer support dosen't work
Closed, ResolvedPublic

Description

Steps to reproduce

See https://github.com/JeroenDeDauw/Maps/pull/131/files

And test fails at https://travis-ci.org/JeroenDeDauw/Maps/builds/121273121 without using the workaround by including autoload.php at the top

Test passing with the workaround https://travis-ci.org/JeroenDeDauw/Maps/builds/121274793

Actual results

Note I made changes so you wont see my change I made but if you remove from the top of the php main file

if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
	include_once( __DIR__ . '/vendor/autoload.php' );
}

you will be able to reproduce it.

Expected results

  • The test should not fail with could not find this class which is added in composer. Which we use config "load_composer_autoloader" to load autoload.php but it doesn't seem to find the one in the extension because it fails wheras using
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
	include_once( __DIR__ . '/vendor/autoload.php' );
}

works in php.

Please could this be fixed so it searches both mw core and extensions or just mw core and extension in the integration tests and extensions only when using them locally or on website please.

Details

Event Timeline

Paladox created this task.Apr 6 2016, 9:37 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 6 2016, 9:37 PM
Paladox updated the task description. (Show Details)Apr 6 2016, 9:39 PM
Florian added a subscriber: Florian.Apr 6 2016, 9:54 PM

Change 282069 had a related patch set uploaded (by Florianschmidtwelzow):
Load extra autload files before executing callbacks

https://gerrit.wikimedia.org/r/282069

Change 282069 merged by jenkins-bot:
registration: Load extra autoload files before executing callbacks

https://gerrit.wikimedia.org/r/282069

Aklapper updated the task description. (Show Details)Apr 7 2016, 8:44 AM

That fixed it but now it fails with https://travis-ci.org/JeroenDeDauw/Maps/jobs/121311553

Including vendor/autoload.php ontop fixed the problem so using extension.json on its own will cause that error or if you didn't add autoload.php to the main php file would cause that. But Maybe moving
foreach ( $info['autoloaderPaths'] as $path ) {
above foreach ( $info['globals'] as $key => $val ) { may fix the problem.

Or moving $autoloaderPaths = array_merge( $autoloaderPaths, to above $autoload = $this->processAutoLoader( dirname( $path ), $info );

Change 282168 had a related patch set uploaded (by Paladox):
Fix composer in extension registration

https://gerrit.wikimedia.org/r/282168

Florian changed the task status from Open to Stalled.Apr 29 2016, 9:28 PM
Florian triaged this task as Lowest priority.

I really don't see any problem with extension registration here, sorry. I think it's possible that this has something to do with how the extension initializes in general, I don't know. Unfortunately, I don't have the time to dig into the extension to find out, where the problem is. Depending on the fact, that this conversion is the only case of this task (at least as far as I know), I'll set this to Stalled and to lowest priority. If you can proove, that this is a problem with extension registration, feel free to set it to open and set an appropriate priority (you can also ask me to re-visit this). Maybe you can talk with the extension creator(s) to figure out, where the problem is. Otherwise, I don't see any task for us here, sorry.

Change 282168 abandoned by Paladox:
Fix composer in extension registration

https://gerrit.wikimedia.org/r/282168

Legoktm closed this task as Resolved.Oct 16 2018, 6:12 PM
Legoktm assigned this task to Florian.

I think this was resolved by T131978#2185044. Please re-open with clear reproduction steps if not.