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 class loader can be swapped out either manually (by editing settings.php
) or since #2296009: Use APC Classloader by default (when available) automatically if APCu is present on the machine. However, the application kernel is constructed before settings.php
is evaluated, and the classLoader
property of the kernel gets out-of-sync if the class loader is subsequently swapped out.
Proposed resolution
Update DrupalKernel::classLoader
if changed during createFromRequest()
.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#9 | interdiff.txt | 604 bytes | znerol |
#9 | 2474817-synchronize-class-loader-9.diff | 2.03 KB | znerol |
#3 | interdiff.txt | 1.76 KB | znerol |
#3 | 2474817-synchronize-class-loader-3.diff | 2.03 KB | znerol |
#1 | 2474817-synchronize-class-loader.diff | 489 bytes | znerol |
Comments
Comment #1
znerol CreditAttribution: znerol commentedThis is expected to result in the same test-failures as #2389811-66: Move all the logic out of index.php (again) because the APCu class-loader should now be propagated into
TestDiscovery
where it causes an exception due to the type-hint against the composer class loader.Comment #2
znerol CreditAttribution: znerol commentedComment #3
znerol CreditAttribution: znerol commentedFix
TestDiscovery
.Comment #5
andypostIs there a way to use some interface here for type-hint?
This will not pass docs gate
Comment #6
znerol CreditAttribution: znerol commentedI do not think so. Neither composer class loader nor the APC one from Symfony implement an interface . This just replicates changes made to
DrupalKernel
constructor (#2325197-15: Remove drupal_classloader()). If there is a problem with the documentation, we need to fix that inDrupalKernel
also.Comment #7
znerol CreditAttribution: znerol commentedRelated #2023325: Add interface for classloader so it can be cleanly swapped
Comment #8
Fabianx CreditAttribution: Fabianx commentedThanks for the patch, but does that work for the settings.php use case as well? (which can't change the kernel class loader obviously)
Comment #9
znerol CreditAttribution: znerol commentedOh, right.
Comment #10
Fabianx CreditAttribution: Fabianx commentedRTBC, thanks, just a normal bug.
Comment #11
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 83d2660 and pushed to 8.0.x. Thanks!