When users aren't logged into my drupal system, the following error message appears at the bottom:

Fatal error: Call to undefined function: drupal_set_html_head() in /home/cocoa/public_html/modules/codefilter/codefilter.module on line 15

As seen on the bottom on this site: http://www.cocoa.se/

however, when a user is logged in it doesn't throw that error.

(I'm running drupal 4.4.2)

Comments

anj’s picture

I fixed this by moving the offending line (21)

drupal_set_html_head('style type="text/css">@import url(' . $GLOBALS[base_url] . '/modules/codefilter/codefilter.css);');
out of the codefilter_init function, and placing it at the start of the codefilter_filter function.  The drupal_set_html_head function is not declared when the modules are initialized, and anyway, I think it makes more sense for the module to only patch the HTML headers if it is actually being invoked for that page.  Unless I've misunderstood and codefiler_filter can be called more than once per page, in which case we might end up with the same stylesheet being included many times (depending on how drupal_set_html_head works).


Cheers,
The Stoat.
anj’s picture

I fixed this by moving the offending line (21)

drupal_set_html_head('style type="text/css">@import url(' . $GLOBALS[base_url] . '/modules/codefilter/codefilter.css);</style>');

out of the codefilter_init function, and placing it at the start of the codefilter_filter function. The drupal_set_html_head function is not declared when the modules are initialized, and anyway, I think it makes more sense for the module to only patch the HTML headers if it is actually being invoked for that page. Unless I've misunderstood and codefiler_filter can be called more than once per page, in which case we might end up with the same stylesheet being included many times (depending on how drupal_set_html_head works).

Cheers,
The Stoat.

The Directive’s picture

Codefilter module does not work in version 4.5.0 because "Fatal error: Call to undefined function: drupal_set_html_head()".

freyquency’s picture

Codefilter works fine for me in 4.5 and 4.5.1.

But I get the same error with 4.5.2

I think it's actually just the main index page, as when I type in /login to get to the login page it is ok and I'm not logged in yet.

chrisada’s picture

For me, this only occurs with caching turned on.

Steven’s picture

drupal_set_html_head() is still present in Drupal 4.5.2. Are you sure you're running the right version? Check your includes/common.inc file.

tulula’s picture

This started happening to me only today and seemed only after I set up new events which were supposed to be only viewable (node_by_privacy) to all registered users and not anonymous users. Correlation?
Events ARE showing for all users regardless of logged in or not - still, the fatal error is above all the kicker!

Rick Cogley’s picture

I started getting this problem after I set up multiple db access to the same Drupal source tree, using a symlink for the second domain which was set up w/ Vhosts in apache.

Looking at the error being from codefilter, I managed to access the site using other paths (/node etc) and then disabled it. Now however, I am getting the same error from other modules. Seems like it is just going down the line.

I will try disabling the cache and report back.

Regards
Rick Cogley
Tokyo

Rick Cogley’s picture

I disabled the cache in both the first "regular" site and my second "symlink" site. The problem has gone away, sort of.

Observations -

* seems to be related to me being logged in on both sites. If I am in my browser (maxthon) and am not logged in, and then switch URLs this error still occurs. However, it is occuring with less zeal than what was happening before with caching enabled.

* sometimes, hand entering the URL in the browser triggers the error from either site, but, clicking on the Home button allows the site to load from the base URL.

Regards,
Rick Cogley
Tokyo

media girl’s picture

Priority: Normal » Critical

Has anyone learned more about this? I have had numerous people complain about this error and have disabled cache for now. But that hardly seems like a long-term solution. Did that code hack above work?

FWIW, I'm experiencing this error on a 4.5.2 clean installation. I've had no problems (that I know of) on my sites with 4.5.0 and 4.5.1 (which have not been updated for no particular reason).

Thanks!

Anonymous’s picture

happened to me after enabling cache.

This is the complete error message.
Fatal error: Call to undefined function drupal_set_html_head() in /usr/home/web/blalba/modules/fckeditor/fckeditor.module on line 60

I'm running Drupal 4.5.2 on PHP5

luigi-1’s picture

sorry, last comment was mine

tulula’s picture

Had this problem until changing caching - now I just tried to install the Internationalization module and PRESTO, problem back again... AND Caching is currently OFF... can't get back in to change that up again! ARGH!

tulula’s picture

http://drupal.org/node/18717

Just added this under Internationalization module issues too... completely hooped here at present

Lisa

Walt Esquivel’s picture

Title: Fatal error: Call to undefined function: drupal_set_html_head() » Fatal error: Steps to LOG IN
Project: Code Filter » Drupal core
Version: » 4.6.0
Component: Code » module system

Hi,

First off, I tried submitting this and the on-screen message stated that I must choose a component system. I could be wrong in having chosen "module system", but I went ahead and chose it since this "fatal error" occurs across several different modules and appears to have more to do with caching than a specific module (caching wasn't a choice, or I would have chosen it).

I’m running Drupal 4.6.1 on a Linux server, Apache version 1.3.33 (Unix), Perl version 5.8.1, PHP version 4.3.11, MySQL version 4.0.22-standard. I use Internet Explorer and Windows XP. I'm using 4.6.0 modules (there aren't any 4.6.1 modules as 4.6.1 is really just a bug fix/minor issues fix release).

I kept getting a similar "Fatal error: Call to undefined function: drupal_set_html_head()" type error.

However, it kept identifying modules/nodewords/nodewords.module as the problem instead of the codefilter.module, fckeditor.module, or Internationalization modules. It seems this "fatal error" is not very picky and I agree with this comment that I copied and pasted from the posts below:

#5 submitted by chrisada on January 16, 2005 - 15:13
For me, this only occurs with caching turned on.

It seems to me that when I go to administer->settings and scroll down to "Cache settings" and then under "Cache support:" click on "Enabled", I get the "fatal error" being described all throughout these postings.

I, too, couldn't log in at http://www.mysite.com and then tried http://www.mysite.com/admin/ and was then able to log in. The first thing I did after logging in was DISABLE my cache settings!

I hope that helps,
Walt

Bèr Kessels’s picture

Title: Fatal error: Steps to LOG IN » Fatal error: Call to undefined function: drupal_set_html_head()

Changing the title changes it for the whole thread.

tostinni’s picture

Version: 4.6.0 » x.y.z

Moving to CVS, this doesn't seem to apply anymore as the function drupal_set_html_head() exists in common.inc.

Should we close this ? At least I think that this is now not critical.

killes@www.drop.org’s picture

Status: Active » Fixed

fixed, the user had a mismatch in core/cotnrib version numbers.

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)