Closed (duplicate)
Project:
Drupal core
Version:
6.16
Component:
update.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Mar 2010 at 14:09 UTC
Updated:
24 May 2010 at 13:24 UTC
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
Comment #1
heine commentedDuplicate of #732096: Fatal error: Call to undefined function: array_intersect_key() in url/modules/update/update.compare.inc on line 695
Comment #2
andrewjsledge commentedA 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.
Comment #3
heine commentedThe patch was committed in #732096-15: Fatal error: Call to undefined function: array_intersect_key() in url/modules/update/update.compare.inc on line 695.
Comment #4
mingos commented@asledge: thanks, mate, your patch worked perfectly for me.