This happens when I try to subscribe to a content type via Notifications UI.

Fatal error: Call to undefined function: array_combine() in /var/www/mydir/drupal/sites/mysite/modules/notifications/notifications.admin.inc on line 365

Simply, array_combine() is available only on PHP 5. I see other similar errors on this module, so a PHP4 user cannot use this module at all for (few) functions written for PHP5. Can you use a backward-compatible alternatives for these?

Comments

jose reyero’s picture

For now, I'v just added the PHP 5.x requirement to the module description.

Willing to fix it as long as someone else provides a patch. The problem is my dev environment is PHP5 only from some time ago, so I cannot even test for PHP4.

markus_petrux’s picture

Here's a possible solution to this:

http://www.php.net/manual/en/function.array-combine.php#82244

<?php
if (!function_exists('array_combine')) {
  function array_combine($arr1, $arr2) {
    $out = array();
    $arr1 = array_values($arr1);
    $arr2 = array_values($arr2);
    foreach($arr1 as $key1 => $value1) {
      $out[(string)$value1] = $arr2[$key1];
    }
    return $out;
  }
}
?>
halfiranian’s picture

I'm using PHP5 - my site is hosted at www.bluehost.com which apparently only has PHP5.

Any ideas?

Cheers

jose reyero’s picture

Status: Active » Fixed

Thanks, just copied and pasted the code in the module, I guess it won't break anything else..

(I just wish we had some php4 compatibility drupal module which had all these functions...)

Anonymous’s picture

Status: Fixed » Closed (fixed)

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