Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Jan 2012 at 18:30 UTC
Updated:
14 Oct 2014 at 00:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
glennpratt commentedD8 patch, could probably be more robust and needs tests.
Comment #2
glennpratt commentedComment #3
glennpratt commentedD7 patch is identical except paths.
Comment #4
glennpratt commentedCross reference for contrib autoload module. http://drupal.org/node/1400160
Comment #5
eric_a commentedSoon the registry won't be with us anymore in D8 (#1541674: Remove the registry), so moving this to D7. Tagging PSR-0.
Comment #7
adamwight commentedHere's a patch against 7.23, including tests.
Unfortunately, multiple namespaces in a file cannot be supported without much more intensive parsing, so this isn't a complete solution.
Glad to hear the registry will go away in D8!
Comment #8
adamwight commentedComment #10
adamwight commentedPatch now tracks the 7.x branch.
Comment #11
adamwight commentedTODO:
* patch documentation
* announce new feature in release notes
Comment #12
adamwight commentedTagging with PSR-4
Comment #13
adamwight commentedComment #14
adamwight commentedComment #15
fabianx commentedRTBC works great for me, I created Registry Autoload module to support this without patching core:
https://www.drupal.org/sandbox/fabianx/2354855
One namespace per file should be enough.
Comment #17
fabianx commentedBesides no longer applying the regexp also needs work.
We cannot expect people to put the namespace on the same line as the <?php part and this is a violation of our code standards.
Comment #18
donquixote commentedJust saying, this problem has been solved by other people already.
Composer:
https://github.com/composer/composer/blob/master/src/Composer/Autoload/C...
("This file is copied from the Symfony package.")
xautoload:
http://cgit.drupalcode.org/xautoload/tree/src/Discovery/FileInspector.ph...
(This reminds me that I should put some credit into this file, since I have most of this from Composer.)
Registry Autoload:
http://cgit.drupalcode.org/sandbox-Fabianx-2354855/tree/registry_autoloa...
Comment #19
donquixote commentedTo avoid hijacking this thread: #2356021: Bad ideas in D7 core autoload system