Permalink
Browse files

fix(session): Session is again available in the shutdown event

Fixes #9243
  • Loading branch information...
mrclay committed Dec 18, 2015
1 parent a8de1c4 commit 2409d346a95a1c5a254f32d51204054a939b7e95
Showing with 13 additions and 4 deletions.
  1. +3 −4 engine/lib/elgglib.php
  2. +10 −0 engine/start.php
View
@@ -1407,6 +1407,8 @@ function _elgg_normalize_plural_options_array($options, $singulars) {
*
* @see http://www.php.net/register-shutdown-function
*
+ * @internal This is registered in engine/start.php
+ *
* @return void
* @see register_shutdown_hook()
* @access private
@@ -1916,10 +1918,7 @@ function _elgg_init() {
elgg_register_js('elgg.ui.river', 'js/lib/ui.river.js');
elgg_register_css('jquery.imgareaselect', 'vendors/jquery/jquery.imgareaselect/css/imgareaselect-deprecated.css');
-
- // Trigger the shutdown:system event upon PHP shutdown.
- register_shutdown_function('_elgg_shutdown_hook');
-
+
// Sets a blacklist of words in the current language.
// This is a comma separated list in word:blacklist.
// @todo possibly deprecate
View
@@ -24,6 +24,16 @@
global $START_MICROTIME;
$START_MICROTIME = microtime(true);
+// we need to register for shutdown before Symfony registers the session_write_close() function
+// https://github.com/Elgg/Elgg/issues/9243
+register_shutdown_function(function () {
+ // There are cases where we may exit before this function is defined.
+ // TODO move this to Application::create in 2.0
+ if (function_exists('_elgg_shutdown_hook')) {
+ _elgg_shutdown_hook();
+ }
+});
+
/**
* Configuration values.
*

0 comments on commit 2409d34

Please sign in to comment.