securesite fails to allow access to some URLs because a call to drupal_get_path_alias fails with "Call to undefined function" i n line 346.

I believe this is because drupal_get_path_alias is defined in includes/path.inc but this file is not included during bootstrap for cached pages. Since the client connection is anonymous and is attempting access specifically provided by securesite, it makes sense the URL / page will usually be in cache, and this is will fail most of the time.

From a quick look at the CVS commit messages, it appears this may be a recent addition to the code.

Comments

Chris Johnson’s picture

It appears the problem is more complicated than I had first thought -- and thus, it is unlikely that a recent CVS commit to securesite is the cause.

As a test, I fixed the problem with the missing includes/path.inc functions. I got new errors about missing functions from includes/common.inc. Fixing that gave me new errors for missing functions in includes/theme.inc.

Clearly the problem is that the system has not bootstrapped any of these pieces, but rather only the bare minimum in includes/bootstrap.inc for cached pages. I'm not sure what this means. On the one hand, it makes sense that something which is trying to authenticate anonymous users, which is what securesite is all about, would have cached pages. On the other hand, this module apparently works for most people using it, so they are not encountering this problem.

I will continue to research and report any useful findings.

Chris Johnson’s picture

This seems to be some sort of interaction with the opensearch module, which provides an XML search result feed for client aggregators.

NaX’s picture

Do you still get error messages if you disable the opensearch module. If you do still get errors, are they different.

Chris Johnson’s picture

Updated to latest 4.7 release version (securesite.module v1.2.2.24), disabled opensearch and most everything else, and hit home page. I got this:

Fatal error: Call to undefined function: drupal_lookup_path() in /usr/local/hm/DRUPAL-4-7/modules/securesite/securesite.module on line 391
Titus98usn’s picture

Version: 4.7.x-1.x-dev » 5.x-1.0

I'm using secure site 5.x-1.0 with Drupal 5.1 & I'm getting the following error on my main page using IE:

Fatal error: Call to undefined function: drupal_lookup_path() in /my/drupal/path/modules/securesite/securesite.module on line 387

anders.fajerson’s picture

I got the mentioned error "Fatal error: Call to undefined function drupal_lookup_path() in securesite.module on line 387" when I added a page in the "Bypass Login Filter Pages"-box and then tried to access the page. Is that what you others to do initiate this error?

Googling on it I found a comment from chx at http://drupal.org/node/46291. Adding drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); below function securesite_check_path() removed the error message and let me access the page. No idea if that is the right way to do it though.

FiReaNGeL’s picture

I get Fatal error: Call to undefined function drupal_get_normal_path() in D:\wamp\www\zscience\modules\quickstats\quickstats.module on line 23

on a custom module I build on cached pages, so I dont think its a problem related to Secure Site; it must be drupal related; not loading the appropriate libraries on cached pages?

NaX’s picture

Status: Active » Needs review

Try this; add the following to line 385 in the securesite.module file.


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

FiReaNGeL’s picture

Nax suggestion fixed the problem for my custom module; I'm sure it'll for securesite too.

Steven’s picture

Status: Needs review » Fixed

Tested locally and verified it. With caching enabled, the listed code is required to make the path lookup work.

Since I've been doing some recent code cleanup, and NaX proposed the change, I went ahead and committed it to 4.7 and 5.

Anonymous’s picture

Status: Fixed » Closed (fixed)
jswap’s picture

Project: Secure Site » Drupal core
Version: 5.x-1.0 » 5.7
Component: Code » base system
Status: Closed (fixed) » Active

I am seeing the bug periodically in Drupal v5.7. It seems to only happen when I make a request for a page other than the front page, after having not visited the site in several hours. The error message is:

"Fatal error: Call to undefined function drupal_get_path_alias() in /usr/local/drupal-5.7/includes/common.inc on line 1193"

This particular error was caused by a request for a blog page (//?q=blog).

drumm’s picture

Project: Drupal core » Secure Site
Version: 5.7 » 5.x-1.0
Component: base system » Code
Status: Active » Closed (fixed)

jswap - if you are using the securesite module, see above, it has been fixed for almost a year.

If this is another problem, then open a separate issue. There is a good chance you have a contributed module implementing hook_init() which uses the path system.