Line 695 in ./modules/update/update.compare.inc contains the PHP function array_intersect_key, which is a PHP 5-only function. Drupal 6.16 is supposed to be PHP 4 compatible. Upon updating to 6.16, an error will be produced when visiting any administration page:

Fatal error: Call to undefined function: array_intersect_key() in /var/www/htdocs/modules/update/update.compare.inc on line 695

Here is the original version of that function:

<?php
function update_filter_project_info($info) {
  $whitelist = array(
    '_info_file_ctime',
    'datestamp',
    'major',
    'name',
    'package',
    'project',
    'project status url',
    'version',
  );
  return array_intersect_key($info, drupal_map_assoc($whitelist));
}
?>

Here is the proposed patch code. It reproduces the same functionality as that function:

<?php
function update_filter_project_info($info) {
  $whitelist = array(
    '_info_file_ctime',
    'datestamp',
    'major',
    'name',
    'package',
    'project',
    'project status url',
    'version', 
  );

  $drupal_wl = drupal_map_assoc($whitelist);
  $intersects = array();
  foreach ($info as $key => $value) {
    if(array_key_exists($key, $drupal_wl)) {
      $intersects[$key] = $value;
    }
  }

  return $intersects;
}
?>

Attached is a patch file to correct the code.

Comments

heine’s picture

andrewjsledge’s picture

Status: Closed (duplicate) » Needs review

A search for "array_intersect_key" restricted to version 6.16 with category, priority, component, and status set to "open issues" returned no results. I see that the duplicate issue is closed. Shouldn't issues remain open unless there is an official patch or bug release? It doesn't make any sense to close it.

heine’s picture

mingos’s picture

@asledge: thanks, mate, your patch worked perfectly for me.