Problem/Motivation
We currently include autoload.php twice, once in index.php and again in drupal_classloader() to get the actual $loader instance. The former is only really included so Settings can be initialised in drupal_settings_initialize(), which is called from _drupal_bootstrap_configuration() (and in index.php if an exception is caught). So, if E.g. the APC classloader is used, we are still going to the filesystem to load the settings class via the standard autoloader.
Proposed resolution
manually include the Settings.php class to circumvent using the classloader before drupal_classloader() has had a chance to do its thing.
Remaining tasks
Reviews on approach. Maybe better issue name?
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#14 | 2253593-early-classmap-13.patch | 3.91 KB | neclimdul |
#13 | 2253593-early-classmap-13.interdiff.txt | 4.5 KB | neclimdul |
Comments
Comment #1
catchLooks good to me.
Comment #3
damiankloip CreditAttribution: damiankloip commentedMehh, Crypt::hmacBase64() is called from drupal_valid_test_ua() which is called from conf_path() :(
Comment #4
sunComment #5
neclimdulbumping as a follow up to #2016629: Refactor bootstrap to better utilize the kernel which makes this more important by adding more classes and interfaces to this code path.
Comment #6
damiankloip CreditAttribution: damiankloip commentedSounds like a good idea to me. Also definitely makes sense to wait on that for sure.
Comment #7
neclimdulPatch built on top of the kernel patch. Won't apply so not bumping status but just as an idea of how we can use composer to do this.
Comment #8
Wim LeersComment #9
dawehnerAdded a related issue: #2421479: Use a bootstrap.php file to load the most used classes in one go which kind has a similar idea, but just more radical.
Comment #10
neclimdulHere's an updated patch for this issue.
Comment #12
damiankloip CreditAttribution: damiankloip commentedIf we have bootstrap.inc included by autoload.php, we have this loaded in unit tests too. Is that what we want?
Comment #13
neclimdulProbably not, that was in the original patch but I think at the very least its outside the scope of this issue.
Also, re-apply accidentally applied composer changes to both composer files but should really have only applied to core/composer.json.
Comment #14
neclimdulwow... how did I not notice there was no patch here. still had it laying around. still applies.
Comment #15
Fabianx CreditAttribution: Fabianx commentedRTBC, coming from #1818628: Use Composer's optimized ClassLoader for Core/Component classes, I just benchmarked this saves around 0.752 ms, so almost 1 ms, which of 5 ms getting to settings.php and 10 ms for PageCache is a lot.
Comment #16
catchCommitted/pushed to 8.0.x, thanks!
Comment #19
BerdirThis is a problem apparently when you are using composer to build your project, see #2468499: Add vendor libs to classmap through composer script event. Please review the patch over there.