I got this error on my server:
Fatal error: Call to undefined function: getallheaders()

I think it has to do with how apache/php, was configured on my server, I've read that it might have to do with whether PHP was installed as a module or not. But to fix this I had to add the lines to the top of trackfield_graph.inc:

if (!function_exists('getallheaders'))
{
  function getallheaders()
  {
    foreach ($_SERVER as $name => $value)
    {
      if (substr($name, 0, 5) == 'HTTP_')
      {
         $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
      }
    }
    return $headers;
  }
}

I also had to comment out the apache_setenv() call:

  /*
   * We're going to have to return an image now.
   * Tell Apache not to compress it again.
   */

//  apache_setenv('no-gzip', '1');
CommentFileSizeAuthor
#2 trackfield_graph.inc_.patch.txt1.05 KBwcleong

Comments

raintonr’s picture

Priority: Normal » Minor

OK - fair enough. I only have an Apache set-up to test this though. It's low priority for me then I'm afraid.

wcleong’s picture

StatusFileSize
new1.05 KB

No problem, I appreciate that you put this module together in the first place. I'm not a coder by trade, and wouldn't have been able to get anywhere close to what you've done with this module. Anyways, just trying to help out here, I've tried my hand at creating a patch to fix this issue for me. Perhaps this will help other users that encounter this problem.

This hopefully fixes the problem of the getallheaders() and apache_setenv() functions that are missing depending on the web server configuration. I don't think this change will impact the people that don't have this problem. This patch performs two things, creates a getallheaders() function if one doesn't exist, and doesn't call apache_setenv() if this function doesn't exist. Neither action will happen for people who haven't encountered this problem. (As far as I know, I can't test it in that environment)

p.s. I'm new to contributing to drupal, so I wasn't sure if I'm supposed to change the status of this issue to "Needs Review", or "Patch", or "fixed"

raintonr’s picture

Status: Active » Fixed

Re: #2: Thanks, patch has been committed to check for existence of apache_setenv and use the $_SERVER variable rather than getallheaders.

Committed in both D5 and D6 branches.

Status: Fixed » Closed (fixed)

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