I found a small but annoying bug while investigating this issue: http://drupal.org/node/170557

When drupal_goto is invoked after form redirect, devel tries to write to footer of the redirect response, after Location header is set. This results in watchdog errors, since theme is already unloaded and working dir is already reset.

The fix is very simple - to add a check that $theme global still exists.

CommentFileSizeAuthor
devel.module_14.patch618 bytesdkruglyak

Comments

moshe weitzman@drupal.org’s picture

how does a theme get unloaded? i haven't looked very closely yet.

the whole point of the forum redirection page is that you stop the redirect so developer can view the queries and other debug info. does this patch compromise that?

dkruglyak’s picture

How it gets unloaded? Not sure, perhaps some subtle issue/bug in how PHP shutdown functions interact with headers...

This can be tracked by putting a watchdog call into shutdown function to output $theme var and current directory with getcwd(). If there is no redirect they are ok (current theme and drupal home dir). However, once drupal_goto called header("Location") PHP starts cleanup and watchdog shows $theme unset and current dir set to '/'. Then devel_shutdown tries to reload the theme and fails since the working directory is reset - dumping senseless messages into the log...

Redirection option of devel module is not compromised by this patch - I tested it. The patch condition is only triggered when $theme has been unset, that happens only in extraodinary circumstances...

moshe weitzman@drupal.org’s picture

Status: Reviewed & tested by the community » Fixed

i think i fixed this differently. please reopen if not.

Anonymous’s picture

Status: Fixed » Closed (fixed)