When editing a users page Drupal dies with the error:

Fatal error: Call to undefined function: array_intersect_key() in /var/www/html/drupal-4.7/modules/roleassign/roleassign.module on line 102

Running on PHP 4.3

CommentFileSizeAuthor
#2 roleassign.patch1.23 KBpjb

Comments

budda’s picture

Also occurs in the 4.7 package, line 100.

pjb’s picture

Status: Active » Needs review
StatusFileSize
new1.23 KB

array_intersect_key is a PHP5 function so that's likely the issue since you're running 4.3. I found this on the array_intersect_key page on PHP.net:

if (!function_exists('array_intersect_key')) {
   function array_intersect_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;
   }
}

Patch is included that adds this to the beginning of the module file. The patch also includes the minor fix to your previous bug documented in http://drupal.org/node/85546 :)

pjb

TBarregren’s picture

Assigned: Unassigned » TBarregren
Status: Needs review » Closed (fixed)

I developed the module for PHP5 and missed to test on PHP4 :*)

Thanks budda who pointed it out, and pjb who provided a solution.