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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patchnewbie’s picture

Assigned: Unassigned » patchnewbie

This looks like a good patch for someone new to core development.

Timotheos’s picture

This can be caused by a faulty info file. In my case it was the devel-themer module that has the line dependencies = devel rather then dependencies[] = 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?

catch’s picture

Title: E_ALL warnings in module admin page using /modules directory » E_ALL warnings in module admin page - .info files
catch’s picture

Line 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

aufumy’s picture

Status: Active » Needs review
FileSize
862 bytes

If dependencies not an array in modules info files, then return true to _system_is_incompatible()

Pasqualle’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
908 bytes

rerolled, tested, works

Gábor Hojtsy’s picture

Is the dependencies key initialized to an array if it is not set in the file?

Pasqualle’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
952 bytes

Yes, 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..

Gábor Hojtsy’s picture

I 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.

Pasqualle’s picture

Yes, the info file reader initializes an empty array in this case, and the patch works correctly with those modules. Does not mark them incompatible.

webernet’s picture

Whatever 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".

Gábor Hojtsy’s picture

weberner: 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.

webernet’s picture

Title: E_ALL warnings in module admin page - .info files » E_ALL - Module admin page - .info file compatibility check

OK - 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.

Pasqualle’s picture

drupal 5 format (http://drupal.org/node/101009)
dependencies = taxonomy comment

does it need to be converted, or the pach is sufficient?

Gábor Hojtsy’s picture

Uhm, no. If the dependencies key is not an array, then that quickly shows us it is not compatible.

gtcaz’s picture

Still seeing this in rc2.

warning: Invalid argument supplied for foreach() in modules/system/system.admin.inc on line 580.

Pasqualle’s picture

@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.

Pasqualle’s picture

FileSize
951 bytes

reroll, please review

gtcaz’s picture

FileSize
2.2 KB

No -- I did look for that and couldn't find anything. Attached are all the .info strings for the models and themes I have installed.

Pasqualle’s picture

@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?

Pasqualle’s picture

and 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

gtcaz’s picture

No, I just see two warnings. Great! I'll apply the patch and report back.

gtcaz’s picture

Patch applies cleanly. Errors are gone. Event modules marked incompatible. Excellent!

Pasqualle’s picture

Status: Needs review » Reviewed & tested by the community

thanks for the test

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed
FileSize
1.09 KB

Updated the docs a bit, and committed this one. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.