Just spend 3hours searching for this bugger.

When using the drupal.org/project/js module in combination with chatblock and you have link username to profile checked, the path alias cannot be generated because the js.php file from the js module does not include the path.inc core file. So to fix this add
require_once DRUPAL_ROOT . '/includes/path.inc';

to line 33 of js.php in the root of our website.

CommentFileSizeAuthor
#1 patch-2163215-001.diff850 bytesacidtalks

Comments

acidtalks’s picture

StatusFileSize
new850 bytes

I'm getting a similar error when using the Overlay module:

Fatal error: Call to undefined function current_path() in .../modules/overlay/overlay.module on line 131

Your recommended fix works for me but I'm not sure if the js module is the right place for a fix. If you use the default bootstrap phase DRUPAL_BOOTSTRAP_DATABASE there is no need to include path.inc. But Chatblock uses DRUPAL_BOOTSTRAP_LANGUAGE where path.inc is needed for some modules. So I think it would be better to fix this in Chatblock. This could be done by adding 'path' to the 'includes'-Parameter of the js callback.

diff --git a/sites/all/modules/chatblock/chatblock.module b/sites/all/modules/chatblock/chatblock.module
index a5a261a..2d8bc22 100644
--- a/sites/all/modules/chatblock/chatblock.module
+++ b/sites/all/modules/chatblock/chatblock.module
@@ -505,13 +505,13 @@ function chatblock_js() {
   return array(
     'view' => array(
       'callback' => 'chatblock_chat_callback',
-      'includes' => array('unicode'),
+      'includes' => array('unicode', 'path'),
       'dependencies' => array('user', 'filter'),
       'bootstrap' => DRUPAL_BOOTSTRAP_LANGUAGE,
     ),
     'update' => array(
       'callback' => 'chatblock_chat_update_callback',
-      'includes' => array('unicode'),
+      'includes' => array('unicode', 'path'),
       'dependencies' => array('user', 'filter'),
       'bootstrap' => DRUPAL_BOOTSTRAP_LANGUAGE,
     ),
-- 
1.8.4.2
doitDave’s picture

Status: Needs review » Closed (won't fix)

So this seems to be a very particular error which, in addition, I rather see fixed in JS. Or try whether an older release of JS works - the module had some changes in the last time, I guess. Just a guess.

acidtalks’s picture

The JS module gives you the option to change the bootstrap level. If you don't use this option everything is fine with JS. So I think it's up to the calling module to specify the needed includes, because the JS module has no option to find out which includes are really needed by the calling (chatblock) module if another bootstrap level is used.

The JS documentation says:

... modules may also specify another bootstrap level than the default DRUPAL_BOOTSTRAP_DATABASE,
and additionally required includes files and module dependencies to load.

So I'm unsure if there is a possibility to fix this in the JS module.