call to drupal_get_path_alias() undefined because path.inc not loaded for cached pages

Chris Johnson - February 14, 2007 - 14:14
Project:Secure Site
Version:5.x-1.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

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.

#1

Chris Johnson - February 14, 2007 - 14:38

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.

#2

Chris Johnson - February 16, 2007 - 12:48

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

#3

NaX - February 16, 2007 - 21:47

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

#4

Chris Johnson - February 20, 2007 - 15:15

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

#5

Titus98usn - February 23, 2007 - 23:20
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

#6

fajerstarter - February 24, 2007 - 20:58

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.

#7

FiReaNG3L - April 28, 2007 - 04:02

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?

#8

NaX - May 4, 2007 - 08:05
Status:active» needs review

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

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

#9

FiReaNG3L - May 5, 2007 - 17:35

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

#10

Steven - May 10, 2007 - 08:50
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.

#11

Anonymous - May 24, 2007 - 09:02
Status:fixed» closed

#12

jswap - April 21, 2008 - 20:53
Project:Secure Site» Drupal
Version:5.x-1.0» 5.7
Component:Code» base system
Status:closed» 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).

#13

drumm - April 22, 2008 - 06:48
Project:Drupal» Secure Site
Version:5.7» 5.x-1.0
Component:base system» Code
Status:active» closed

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.

 
 

Drupal is a registered trademark of Dries Buytaert.