Issue with Global Redirect pages

cdale - September 25, 2008 - 21:57
Project:Trace
Version:6.x-1.0-alpha2
Component:Compatibility
Category:bug report
Priority:normal
Assigned:Justin Miller
Status:closed
Issue tags:Global Redirect, trace_hook
Description

This has got me very confused. If I have a url alias of 'contact' for node/5, then when I go to node/5 and globalredirect kicks in to take me to 'contact', I get a "Call to undefined function trace_hook()" in trace.module on line 124, which is the call in hook_exit. This is even weirder, because I have tracing disabled.

On closer inspection, it turned out that TRACE_ACTIVE, and TRACE_HOOKS were not even defined yet. Here is a backtrace at the start of hook_exit.

#0 trace_exit(/contact)
#1 call_user_func_array(trace_exit, Array ([1] => /contact)) called at [/includes/module.inc:471]
#2 module_invoke_all(exit, /contact) called at [/includes/common.inc:312]
#3 drupal_goto(contact-us, , , 301) called at [/modules/globalredirect/globalredirect.module:83]
#4 globalredirect_init()
#5 call_user_func_array(globalredirect_init, Array ()) called at [/includes/module.inc:471]
#6 module_invoke_all(init) called at [/includes/common.inc:2463]
#7 _drupal_bootstrap_full() called at [/includes/bootstrap.inc:1022]
#8 _drupal_bootstrap(8) called at [/includes/bootstrap.inc:933]
#9 drupal_bootstrap(8) called at [/modules/trace/trace.module:17]
#10 include_once(/modules/trace/trace.module) called at [/includes/bootstrap.inc:563]
#11 drupal_load(module, trace) called at [/includes/bootstrap.inc:536]
#12 bootstrap_invoke_all(boot) called at [/includes/bootstrap.inc:994]
#13 _drupal_bootstrap(5) called at [/includes/bootstrap.inc:933]
#14 drupal_bootstrap(8) called at [/index.php:16]

After looking at that, I can see what is happening, but I would have no idea on the best approach for fixing it. It would seem that the trace module calling the bootstrap, which includes all the hook_init calls, but the globalredirect hook_init calls a drupal_goto, which calls hook_exit, but when hook_exit is called here, none of the trace variables are defined yet. Perhaps a solution would be check if TRACE_ACTIVE is defined, and not do anything if it is not?

#1

Justin Miller - September 25, 2008 - 22:17
Assigned to:Anonymous» Justin Miller

Thanks for the feedback. I have not tested Trace with Global Redirect yet, so I will look into this.

#2

EvanDonovan - May 12, 2009 - 19:36

Any progress on this issue? I can confirm it is occurring for me on Global Redirect pages also.

#3

Arto - September 18, 2009 - 16:21
Component:Code» Compatibility
Status:active» fixed

Never had this problem myself, but this was probably related to special cases in Drupal's bootstrap vis-a-vis Global Redirect.

The recent 6.x-1.0 release should solve this problem by moving the trace_hook() function into the main module (instead of having it in an include file), which means that the function in question will always be available regardless of the bootstrap context.

#4

Arto - September 18, 2009 - 16:22
Title:Trace & Globalredirect issues.» Issue with Global Redirect pages

#5

EvanDonovan - September 19, 2009 - 16:03

Thanks. I'll test Trace again soon as part of a new round of performance optimizations on my site.

#6

System Message - October 3, 2009 - 16:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.