Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Just downloaded latest devel tarball to my /modules directory (not sites/all/modules, plain old modules), and I got this error:
warning: Invalid argument supplied for foreach() in drupal6/modules/system/system.admin.inc on line 542.
Comment | File | Size | Author |
---|---|---|---|
#25 | dependencies_array_4.patch.txt | 1.09 KB | Gábor Hojtsy |
#19 | dotinfo.txt | 2.2 KB | gtcaz |
#18 | dependencies_array_3.patch | 951 bytes | Pasqualle |
#8 | dependencies_array_2.patch | 952 bytes | Pasqualle |
#6 | dependencies_array_1.patch | 908 bytes | Pasqualle |
Comments
Comment #1
patchnewbie CreditAttribution: patchnewbie commentedThis looks like a good patch for someone new to core development.
Comment #2
Timotheos CreditAttribution: Timotheos commentedThis can be caused by a faulty info file. In my case it was the devel-themer module that has the line
dependencies = devel
rather thendependencies[] = devel
I'll file a bug report on devel but I'm not sure what is needed in core. Should drupal_parse_info_file force this to be an array? or should we just be checking in system.admin.inc to make sure it's an array?
Comment #3
catchhttp://drupal.org/node/191342 was duplicate
Comment #4
catchLine 542 is from the private function _system_is_incompatible called by system_modules() - which looks like it's breaking system_update_1005() here: http://drupal.org/node/191767
Comment #5
aufumy CreditAttribution: aufumy commentedIf dependencies not an array in modules info files, then return true to _system_is_incompatible()
Comment #6
Pasquallererolled, tested, works
Comment #7
Gábor HojtsyIs the dependencies key initialized to an array if it is not set in the file?
Comment #8
PasqualleYes, if the info file does not contain the dependency property, then it is initialized as an empty array.
So I changed the patch to reinit the value to an empty array. Is it ok, or put the original value into array?
like dependencies = devel
makes now $file->info['dependencies'] an empty array
or change it to $file->info['dependencies'] = {devel}, but then it does not need to be set here as incompatible..
Comment #9
Gábor HojtsyI mean what if the dependency key was not used in the .info file? Then the info file reader initializes this to an array, or not? If not, !is_array($file->info['dependencies']) will mark all modules incompatible which have no dependencies.
Comment #10
PasqualleYes, the info file reader initializes an empty array in this case, and the patch works correctly with those modules. Does not mark them incompatible.
Comment #11
webernet CreditAttribution: webernet commentedWhatever happened to "Core doesn't support broken code"?
If a .info file is malformed, then it's a bug in the .info file. This should probably be "won't fix".
Comment #12
Gábor Hojtsyweberner: uhm, no. This exact function is to check whether the module is compatible with the current core version at hand or not. Previous info files did not have an array in the dependency key, so there comes the error. We need to handle this error here, as the role of this exact function is to identify broken stuff, so it fiddles with broken stuff by definition.
Comment #13
webernet CreditAttribution: webernet commentedOK - Looked at the patch more closely, and yes, it looks like you're right. The original description and discussion made me think this was a quick fix to make things work even if the .info file was malformed.
Comment #14
Pasqualledrupal 5 format (http://drupal.org/node/101009)
dependencies = taxonomy comment
does it need to be converted, or the pach is sufficient?
Comment #15
Gábor HojtsyUhm, no. If the dependencies key is not an array, then that quickly shows us it is not compatible.
Comment #16
gtcaz CreditAttribution: gtcaz commentedStill seeing this in rc2.
warning: Invalid argument supplied for foreach() in modules/system/system.admin.inc on line 580.
Comment #17
Pasqualle@gtcaz: Drupal core modules do not have malformed .info file. Can you find which custom module causing this warning? Search for dependencies string in info files. If it does not have [] square brackets then it's a bug in that .info file, and should be fixed.
Comment #18
Pasquallereroll, please review
Comment #19
gtcaz CreditAttribution: gtcaz commentedNo -- I did look for that and couldn't find anything. Attached are all the .info strings for the models and themes I have installed.
Comment #20
Pasqualle@gtcaz: Thanks for the list. I found two malformed info files in event module (issue http://drupal.org/node/209103). Do you see more than two warnings, should I check the other modules too?
Comment #21
Pasqualleand here is a great opportunity to test this patch
test:
1. install drupal
2. add event module 6.x-2.x-dev (7/1/2008)
3. see the warnings on page admin/build/modules
4. apply patch
5. no warnings, the modules with malformed info files are marked incompatible with Drupal core
6. correct dependencies in the info file
7. reload page admin/build/modules, the modules should be compatible now
Comment #22
gtcaz CreditAttribution: gtcaz commentedNo, I just see two warnings. Great! I'll apply the patch and report back.
Comment #23
gtcaz CreditAttribution: gtcaz commentedPatch applies cleanly. Errors are gone. Event modules marked incompatible. Excellent!
Comment #24
Pasquallethanks for the test
Comment #25
Gábor HojtsyUpdated the docs a bit, and committed this one. Thanks.
Comment #26
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.