When entering multiple keywords separated by comma, the module generates an error, apparently a missing function ?

Fatal error: Call to undefined function array_intersect_key() in /home/sites/all/modules/dynosearcho/dynosearcho.module on line 519

Comments

aalamaki’s picture

Ok, seems that this is a problem of the version of php running on my webhost, the array_intersect_key is supported only on PHP 5.1.0 whereas the php running on the server is 5.0.5, this could be stated in the module requirements.

Would be nice if some other function could be used as many shared servers still run older versions of PHP.

2c’s picture

To get around this, add the following code to your dynosearcho module:

//This following function has been added to ensure backwards computability with PHP versions prior to 5.1.0

      if (!function_exists('array_intersect_key'))
      {
      function array_intersect_key ($isec, $arr2)
      {
      $argc = func_num_args();
      for ($i = 1; !empty($isec) && $i < $argc; $i++)
      {
      $arr = func_get_arg($i);
      foreach ($isec as $k => $v)
      if (!isset($arr[$k]))
      unset($isec[$k]);
      }

      return $isec;
      }
      }
ultimike’s picture

Status: Active » Closed (won't fix)