summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-01 22:46:02 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-01 22:46:02 +0000
commit6a8aecc468a98cce290494dd4daca40f0ba15615 (patch)
treef8b028ab8d512b1b758d620beb12e47824baec36 /includes
parent577fdd212b8c645d3e501f06ceba600e74595e15 (diff)
downloadbrdo-6a8aecc468a98cce290494dd4daca40f0ba15615.tar.gz
brdo-6a8aecc468a98cce290494dd4daca40f0ba15615.tar.bz2
#761212 follow-up by jbrown: Better method of changing to DRUPAL_ROOT.
Diffstat (limited to 'includes')
-rw-r--r--includes/bootstrap.inc7
1 files changed, 5 insertions, 2 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 8fe5beae5..1c13c6fa3 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -3057,7 +3057,7 @@ function &drupal_register_shutdown_function($callback = NULL) {
$args = func_get_args();
array_shift($args);
// Save callback and arguments
- $callbacks[] = array('callback' => $callback, 'arguments' => $args, 'cwd' => DRUPAL_ROOT);
+ $callbacks[] = array('callback' => $callback, 'arguments' => $args);
}
return $callbacks;
}
@@ -3068,9 +3068,12 @@ function &drupal_register_shutdown_function($callback = NULL) {
function _drupal_shutdown_function() {
$callbacks = &drupal_register_shutdown_function();
+ // Set the CWD to DRUPAL_ROOT as it is not guaranteed to be the same as it
+ // was in the normal context of execution.
+ chdir(DRUPAL_ROOT);
+
try {
while (list($key, $callback) = each($callbacks)) {
- chdir($callback['cwd']);
call_user_func_array($callback['callback'], $callback['arguments']);
}
}