When you install Drupal HEAD, and install al modules you will get an error for Simpletest since that requires cURL. But also this error :

Warning: array_multisort(): Array sizes are inconsistent in system_modules_submit() (line 910 of drupal\modules\system\system.admin.inc).

Comments

pingers’s picture

This occurs when there are no modules left to install during the form submission.

I.e. the sort array isn't empty, but the new modules array is.

See the attached patch.

pingers’s picture

Status: Active » Needs review
pingers’s picture

E.g. if you don't have cURL support installed and try to enable simpletest, the bug will be triggered.

pingers’s picture

StatusFileSize
new890 bytes

I made an oversight - it's not that no modules are installed, only that the arrays are different in size.

I.e. Previously, all selected modules are added to the $sort array regardless of being added to the $new_modules array (which contains modules that haven't failed validation).

I've tested conditions:
when there is only 1 module to enable, which fails validation.
when there is only 1 module to enable, which passes validation.
when there is multiple modules to enable, but some pass, some fail.

Status: Needs review » Needs work

The last submitted patch failed testing.

pingers’s picture

StatusFileSize
new779 bytes

Try again... (testing)

pingers’s picture

Status: Needs work » Needs review
cburschka’s picture

Status: Needs review » Needs work
+++ modules/system/system.admin.inc	5 Sep 2009 10:21:25 -0000
@@ -985,7 +985,10 @@
+        // Only add modules to enable, to $sort or array_multisort fails.

I can't quite parse that comment. Was the comma supposed to be there?

Also, when referring to functions you append (), so this should be "array_multisort()".

I'm on crack. Are you, too?

jbrown’s picture

Title: Error upon activation of all modules » array_multisort PHP warning when module failed to install
pingers’s picture

The comment should probably read something like

"Only add modules that will be enabled to $sort. array_multisort() requires a matching number of elements."

Thoughts?

cha0s’s picture

StatusFileSize
new605 bytes

Makes sense to me to put that comment above the else.

cha0s’s picture

Status: Needs work » Needs review
LT-1’s picture

LT-1’s picture

#11: 523208.patch queued for re-testing.

jpmckinney’s picture

Issue tags: -Quick fix
StatusFileSize
new710 bytes

I came across this bug when I tried to enable the simpletest module without fulfilling its cURL requirement. I made the same patch as #11, except I prefer if (condition) {) else {} to if (!condition) {} else {}. Also, with this re-ordering of the code, it's obvious just by reading it that we only wish to enable those modules whose requirements are fulfilled, and so there is no need for a comment.

I'm RTBC's #11 although I prefer my idempotent patch.

jpmckinney’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quick fix

Adding tag.

pingers’s picture

Issue tags: +Quick fix

Looks good to me (still).

klausi’s picture

Status: Reviewed & tested by the community » Needs work

does not apply anymore.

jpmckinney’s picture

Status: Needs work » Fixed

Having read the new system_modules_submit code, the reported warning when calling array_multisort should no longer be reproducible. Fixed by #592800-16: Dependent modules are still installed when required modules return errors in hook_requirements('install')

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix

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