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
#2208429: Extension System, Part III: ExtensionList, ModuleExtensionList and ProfileExtensionList introduced a bug when called for a non-installed module. It should return an empty array but it throws an exception.
Proposed resolution
Catch the exception and return an empty array.
Remaining tasks
User interface changes
None
API changes
None - fixing a breaking change.
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#4 | 2939904-4.patch | 2.53 KB | alexpott |
#4 | 2-4-interdiff.txt | 1.9 KB | alexpott |
#2 | 2939904-2.patch | 1.8 KB | alexpott |
#2 | 2939904-2.test-only.patch | 1.12 KB | alexpott |
Comments
Comment #2
alexpottComment #3
Mile23Thanks, @alexpott.
Should be
assertSame()
.Comment #4
alexpottChanged to use assertSame() and expanded the test to cover more of system_get_info()'s functionality.
Comment #6
dawehnerThis looks like a proper bugfix! Thank you for the detailed test coverage.
Just a general comment: Wouldn't it be nice to have a dedicated exception type for this?
Comment #7
Mile23Running the test without the changes to system.module I got this, which seems appropriate:
Also it's nice to get coverage for themes.
In #3, I meant that
assertSame()
was needed for checking against an expected empty array, but changing them all toassertSame()
is fine, too. :-)And.... I can install ajax_example, which was my original issue: #2208429-340: Extension System, Part III: ExtensionList, ModuleExtensionList and ProfileExtensionList
So this LGTM.
Re: #6, we should really deprecate
system_get_info()
for something else rather than changing its return values.Comment #8
dawehnerMost failure in #2659940: Extension System, Part III: ThemeExtensionList and ThemeEngineExtensionList right now are actually triggered and prevented by this patch.
Comment #9
almaudoh CreditAttribution: almaudoh commentedI believe this to be the case also. So just waiting for this patch to be committed.
Comment #10
larowlanI agree with #6 - can we get a follow up for that?
Adding review credit for @Mile23
Comment #12
larowlanCommitted 38c2ac7 and pushed to 8.6.x.
Thanks!
Comment #13
Mile23Someone just added a pile of deprecations around this: #2940190: [meta] Deprecations of old functions in Extension system and #2940189: Deprecate system_get_info()
Comment #14
almaudoh CreditAttribution: almaudoh commentedCreated #2940203: Use dedicated Exception classes for extension system for that.