In _system_sort_requirements, the string comparison warns about two comparison values that are not a string.

Both time the values to compare are :

array (size=2)
  0 => string 'cURL' (length=4)
  1 => string 'cURL' (length=4)

whereas the correct string would be

string 'cURL' (length=4)

Where can I find the origin of this value to fix this?

Comments

Title:Requirements check comparison output two 'strings' (cURL) and an arrayRequirements check comparison output two 'strings' (cURL) as an array

Title:Requirements check comparison output two 'strings' (cURL) as an arrayTesting module warning: Requirements check comparison output two 'strings' (cURL) as an array

Enabling the Simpletest module from a fresh install causes these errors.

    Warning: strcmp() expects parameter 2 to be string, array given in _system_sort_requirements() (line 3238 of core/modules/system/system.module).
    Warning: strcmp() expects parameter 2 to be string, array given in _system_sort_requirements() (line 3238 of core/modules/system/system.module).
    Warning: usort() [function.usort]: Array was modified by the user comparison function in system_status() (line 2014 of core/modules/system/system.admin.inc).

Title:Testing module warning: Requirements check comparison output two 'strings' (cURL) as an arrayTesting/Aggregator module warning: Requirements check comparison output two 'strings' (cURL) as an array

Both Simpletest and Aggregator have the same cURL as requirement in their install files:

$requirements['curl'] = array(
   'title' => $t('cURL'),
   'value' => $has_curl ? $t('Enabled') : $t('Not found'),
);

Commenting out this requirement from either module makes the warning go.

Any clues on how to fix this?

Ah.

The curl check in aggregator.module was added in the guzzle issue.

Looks like this is one of the famous array_merge_recursive() issues, where on duplicate keys, the value is converted into an array.

So it's not related to PHP 5.4.

Any easy fix would be to prefix the requirements key with the module name. I'm not sure if they are supposed to be unique. A more complex fix might be to treat requirements with the same key as equal and only show once.

In general it would be better if the same keys and values are merged. I have the same issue #1831630: Array being presented to Status report page as I'm doing 100% the same check like core in my module, same strings, same description. Makes no sense that 10 modules warn about the same issue on status report page.

I tried to merge the b-side of the string comparison in system.module.

That would work for the first comparison. But when comparing the next one, content would be completely different, since the amount of a-side values would not match the amount of b-side values.

$b_title = $b['title'];
if (is_array($b_title)) {
  $b_title = array_unique($b['title']);
  $b_title = implode($b_title);
}

If I comment the title in:

$requirements['curl'] = array(
  //'title' => $t('cURL'),
  'value' => $has_curl ? $t('Enabled') : $t('Not found'),
);

Warnings are now gone. But the requirements for cURL are not show in the status report.

I get Array instead of nothing for the whole line if cURL is available or a severity warning if the cURL library is not available.

Yes, what you will have to do is replace module_invoke_all() with a module_implements + manually calling the implementations. Then merge it with a simple $requirements += $module_requirements, make sure to check that $module_requirements is actually an error or that will produce errors.

That means it will ignore everything but the first requirement with the same name. Which needs to be documented somewhere, probably in hook_requirements().

If Guzzle had been a system requirement, rather than a requirement that every single module that wants to make HTTP requests needs to do, this wouldn't be a problem either. We either need to change the way module_invoke_all works or, split the errors up into different ones each time (for several modules that depend on cURL this can result in X duplicate messages, which is not helpful for end users).

This problem is essentially the same for every PHP extension, which might be required by multiple modules.

Therefore, I think we should mark this as duplicate of #1322890: Add a property to .info files to allow modules to specify required php extensions

Also related: #1356170: Remove all uses of array_merge_recursive, or document why they are being used instead of NestedArray::mergeDeep()

Right, the php extension issue or moving this check to system module would resolve this specific case but the problem can happen with anything that is required by two modules. However, #1356170: Remove all uses of array_merge_recursive, or document why they are being used instead of NestedArray::mergeDeep() will solve that, I think. So we can probably mark it as a duplicate of that one.

Yep, that is not about php extensions only. This issue may has very many duplicates in all queues as a side note.

Status:Active» Closed (duplicate)

Duplicate of #1322890: Add a property to .info files to allow modules to specify required php extensions, which should make it a lot easier to define requirements.

However, there still the need to display integrate a row in the Status Report page for requirements that are met but need some more details in the status page, or, like for cURL, display a warning in the Status page.

We define the requirements, and then we act upon the requirements.

Status:Closed (duplicate)» Active

This issue is not about php extensions and therefore not a duplicate.

Status:Active» Closed (duplicate)

No, but a duplicate of #1356170: Remove all uses of array_merge_recursive, or document why they are being used instead of NestedArray::mergeDeep(), which will change how module_invoke_all() works by default.