When loading admin/config you get the error Warning: usort(): Array was modified by the user comparison function in system_status() (Line 2240 in /srv/www/htdocs/modules/system/system.admin.inc).

After a bit of research I found someone explaining why this happens in post #5 in this thread:
http://drupal.org/node/933684

So piwik creates $requirements['http requests'] = array( ... ) but the http requests is used otherwise already by Drupal itself. A simple fix would be to move the http requests into piwiks name space like this:
$requirements['piwik http requests'] = array( ... ). Unfortunately I have absolutely no idea about Drupal module development and cannot provide an idea on how to fix this in the code :(

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acbramley’s picture

Priority: Minor » Major
Status: Active » Needs review
FileSize
1.12 KB

You are correct. It's caused by the fact that piwik does exactly the same check and set in hook_requirements that the system module does:

      if (variable_get('drupal_http_request_fails', TRUE) && !system_check_http_request()) {
        $requirements['http requests'] = array(
          'title' => $t('HTTP request status'),
          'value' => $t('Fails'),
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality. This could be due to your webserver configuration or PHP settings, and should be resolved in order to download information about available updates, fetch aggregator feeds, sign in via OpenID, or use other network-dependent services.'),
        );
      }

This needs to be removed as it causes two things:
a) It causes these errors on the main configuration page and status pages:

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

b) It causes the HTTP Request requirements warning to have "Array" as the title, warning, and description.

There's no point in having the exact same check in 2 modules, especially since it's causing these bugs.

Here's a patch that removes this check from piwik.install

Status: Needs review » Needs work

The last submitted patch, 1271780-piwik-remove-http-check.patch, failed testing.

acbramley’s picture

Rolled patch again using:

git format-patch origin/7.x-2.x --stdout > 1271780-piwik-remove-http-check-2.patch
acbramley’s picture

Status: Needs work » Needs review
wiifm’s picture

Would be keen to get a module maintainer point of view on this issue. I am not too sure that duplicating the core http requirement check is the best way to go here. I think at the very minimum this patch is a step forward.

+1

hass’s picture

Priority: Major » Minor
Status: Needs review » Closed (duplicate)
wiifm’s picture

So @hass, you are saying this is a bug in drupal core? It seems to me like the piwik module is at least partially at fault for re-declaring an existing requirements check. Yes drupal core should probably deal with this nicer, no qualms there - but why not change the name of the piwik requirement to be 'piwik http request' ?

hass’s picture

Yes, core need to be fixed. The reason is that I'm doing this check in 2 modules + 1 core. This makes 3 times the same EXPENSIVE check with the same result. Core need to merge the array per key and make one check only, and as the check is all times 100% the same - the result is also the same and can be shared between all modules without running the same check 3 times.

You need to see this in a bigger picture... e.g. 30 modules need to verify if they are able to issue HTTP requests with drupal_http_request(). This will timeout the page load. If the check is done only once, there is no problem. This may counts only for expensive checks, but as we do have them we need to solve this. This was never a problem in D6. So it's a D7+ bug.