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.
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
Comment #1
xmacinfoComment #2
xmacinfoEnabling the Simpletest module from a fresh install causes these errors.
Comment #3
xmacinfoBoth Simpletest and Aggregator have the same cURL as requirement in their install files:
Commenting out this requirement from either module makes the warning go.
Any clues on how to fix this?
Comment #4
BerdirAh.
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.
Comment #5
hass CreditAttribution: hass commentedIn 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.
Comment #6
xmacinfoI 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.
If I comment the title in:
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.Comment #7
BerdirYes, 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().
Comment #8
Dave ReidIf 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).
Comment #9
sunThis 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()
Comment #10
BerdirRight, 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.
Comment #11
hass CreditAttribution: hass commentedYep, that is not about php extensions only. This issue may has very many duplicates in all queues as a side note.
Comment #12
xmacinfoDuplicate 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.
Comment #13
hass CreditAttribution: hass commentedThis issue is not about php extensions and therefore not a duplicate.
Comment #14
BerdirNo, 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.