When page caching is turned on and an unauthenticated user views a node page, the following error message appears:

Fatal error: Call to undefined function: node_load() in /var/www/feminista/modules/taxonomy_context/taxonomy_context.module on line 17

When page caching is off, everything's fine.

Comments

nedjo’s picture

The line generating the error was unneeded in any case (left over from setting breadcrumbs, now disabled). I've commented it out, and this should fix the issue.

magnestyuk’s picture

Setting this to active again, since the error persists... I don't know what part you mention that you commented out. If you mean the breacrumbs part, commented out in 4.5 with the words "Commented out in response to issue http://drupal.org/node/11407," that's not what I was talking about.

This is the line that is causing me headaches:

$node = node_load(array("nid" => arg(1)));

If I comment it out, taxonomy_node_get_terms() becomes an undefined function.

magnestyuk’s picture

I have to refine my bug report...
With page caching on, if I clear the cache and then load a node page, it shows as it should. On reload, it generates the above error.

magnestyuk’s picture

Priority: Normal » Critical

In response to other undefined function errors, some people have suggested that page caching be turned off. I have modules installed though that make use of caching, e.g. the relatedlinks module, so that's not an option for me.

Also, changed priority to critical, since node pages don't render at all.

kkaefer’s picture

Changing

function taxonomy_context_init() {
  ...
}

to

function taxonomy_context_menu($may_cache) {
  if (!$may_cache) {
    ...
  }
}

solves the problem.

chx’s picture

Credit for this goes to moshe for documenting it, and to me, 'cos I remembered that documentation :)

nedjo’s picture

Thanks for the fix, sorry it's taken me so long to make this obvious and necessary fix. If anyone (with CVS write access) wants to apply this change, please do. Otherwise I'll get to it when I get a chance (I'm away from a CVS-capable machine just now).

njvack’s picture

The version in CVS seems to fix this bug...

nedjo’s picture

Anonymous’s picture