The site I manage has a custom module that makes the drupal_get_path_alias() function call. Every once in a while, this call was failing and, instead of showing the site, it would show a PHP error: Fatal error: Call to undefined function drupal_get_path_alias() in /home/asiaweb/www.asiasociety.org/htdocs/sites/all/modules/as/as_taxonomy_nav/astn.module on line 464

Someone on my web team poked around and saw that this error had occurred with a bunch of modules once Drupal was updated to 5.1

http://drupal.org/node/119009

http://drupal.org/node/360304

To fix the error, we have put the following line of code in as instructed:

  // If cache is enabled we need to load the path system
  if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) {
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  }

before the drupal_get_path_alias function call.

However, I am not so sure that this is a long term solution. When I asked this question in the main Drupal forum I was directed to this:

According to http://api.drupal.org/api/function/hook_init/5:
If you implement this hook and see an error like 'Call to undefined function', it is likely that you are depending on the presence of a module which has not been loaded yet. It is not loaded because Drupal is still in bootstrap mode. The usual fix is to move your code to hook_menu(!$may_cache).

Does anyone have any thoughts on this?

Thanks.