seems like admin is calling a php 5.1 specific function array_diff_key() which fails if hoster doesn't offer php 5.1 (shared hosting environment)...

see http://php.net/manual/de/function.array-diff-key.php

error occurs if you try to call /admin/settings/admin.

paths
/admin/settings/admin/rebuild
and
/admin/settings/admin/theme
work just fine.

CommentFileSizeAuthor
#2 admin-1004124-php-version.diff283 bytesskwashd

Comments

frank pfabigan’s picture

ugly but working workaround: (needed to make it work fast)
adding this function (mentioned on http://php.net/manual/de/function.array-diff-key.php, by contact-at-autonoma-dot-fr) in file /sites/all/modules/admin/admin.admin.inc

function php4_array_diff_key( )
{
$arrs = func_get_args();
$result = array_shift($arrs);
foreach ($arrs as $array) {
foreach ($result as $key => $v) {
if (array_key_exists($key, $array)) {
unset($result[$key]);
}
}
}
return $result;
}

...

and replacing the call to array_diff_key in line 80 (and code around) with this:

#
# heavy changes
#

if( function_exists( array_diff_key )) {
foreach (array_diff_key($block_info, $options) as $bid => $info) {
$module = array_shift(explode('-', $bid));
$module = isset($modules[$module]) ? $modules[$module] : $module;
$custom_options[$module][$bid] = $info['info'];
}
}
else
{
foreach( php4_array_diff_key( $block_info, $options ) as $bid => $info ) {
$module = array_shift( explode('-', $bid));
$module = isset($modules[$module]) ? $modules[$module] : $module;
$custom_options[$module][$bid] = $info['info'];
}
}

#
#
#

tested, works for me.

skwashd’s picture

Status: Active » Needs review
Issue tags: +php4
StatusFileSize
new283 bytes

Thanks for catching this. Instead of adding PHP4 support as you suggested, the attached patch make admin require PHP 5.1 as the minimum requirement for the 6.x-2 branch. Drupal 7 will require PHP 5.2.4+

I honestly believe that if your hosting doesn't offer PHP 5.2, then you should be looking for a new host. PHP4 was "End of Lifed" on 31 December 2008 - over 3 years ago. It is time to move on. I know Drupal 6 support supports PHP4, but many contrib modules don't.

If you really need to PHP4 use, check out PHP_Compat from PEAR.

I have posted the patch here for other the maintainers have a chance to comment. I don't have a PHP4 environment available to test this in, but I'm confident it will work. If none of the maintainers complain I will check it in sometime on 10 January 2011 (AEDT).

skwashd’s picture

Status: Needs review » Fixed

As there were no objections, this was committed as git-fd37862

Status: Fixed » Closed (fixed)
Issue tags: -php4

Automatically closed -- issue fixed for 2 weeks with no activity.