Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The static class mapper preAutoloadDump use a hardcoded path to composer vendor such as
$autoload['classmap'] = array_merge($autoload['classmap'], array(
'vendor/symfony/http-foundation/Request.php',
'vendor/symfony/http-foundation/ParameterBag.php',
....
));
This prevents moving vendor to a different location outside of the webroot.
Proposed resolution
It must use
// The current working directory for composer scripts is where you run
// composer from.
$vendor_dir = $event->getComposer()->getConfig()->get('vendor-dir');
....
$autoload['classmap'] = array_merge($autoload['classmap'], array(
$vendor_dir.'/symfony/http-foundation/Request.php',
$vendor_dir.'/symfony/http-foundation/ParameterBag.php',
));
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#18 | interdiff.txt | 687 bytes | Mile23 |
#18 | 2764267_17.patch | 2.62 KB | Mile23 |
#10 | preautoloaddump_use-2764267-10.patch | 2.67 KB | yogeshmpawar |
#6 | 2764267-6.patch | 2.68 KB | alexpott |
#6 | 1-6-interdiff.txt | 2.27 KB | alexpott |
Comments
Comment #2
cilefen CreditAttribution: cilefen commentedComment #4
alexpottDiscussed with @catch, @xjm, @effulgentsia, @cilefen, and @Cottser. We decided that this is a just a normal bug since it does not affect the vast majority of users. Yes it would be nice to support multiple vendor locations but this does not appear to qualify as a major bug. See https://www.drupal.org/core/issue-priority for definition of issue priority values. @wengerk please update the issue summary with a justification if you feel the major status is warranted.
Comment #5
alexpottThis comment in the same file needs to be updated.
The only other hardcoded access to vendor is in \Drupal\system\Tests\System\HtaccessTest which seems completely fine to me.
Comment #6
alexpottFixed coding standards for concatenating with
.
and #5. Given my changes are cosmetic I think it is okay for me to rtbc.Comment #9
mkalkbrennertriggered re-test
Comment #10
yogeshmpawarStraight re-roll for patch #6 because it's failed to apply on 8.4.x branch
Comment #11
alexpottComment #12
mkalkbrennerWas RTBC earlier and the re-roll works well in our deployments.
Comment #14
Mile23Patch still applies to 8.4.x, and the failing test was Drupal\Tests\inline_form_errors\FunctionalJavascript\FormErrorHandlerCKEditorTest which has a sporadic fail sometimes.
Re-running test, resetting to RTBC.
Comment #16
Mile23Patch still applies, re-running test, resetting RTBC (again).
Comment #17
cilefen CreditAttribution: cilefen commentedThis comment is disorienting. Would it be clearer to comment "Get the configured vendor directory."?
Comment #18
Mile23Ask and ye shall receive.
Also this patch might be good for 8.3.x as well, for better happiness with composer interactions sooner. The patch applies, so I'm leaving this as 8.4.x for the issue, but adding a test for 8.3.x.
And also: This might be a dupe for #2578485: Composer::preAutoloadDump fails with no specified classmap
Comment #20
Mile23Looks like someone re-started the 8.4.x test and it passed.
Comment #21
timmillwoodLooks good to me.
Comment #23
larowlanCommitted as 9eec58d and pushed to 8.4.x.
Thanks.