Skip to content

Commit

Permalink
Rely only on moodle registered shutdown handlers to save the session
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanheywood committed May 6, 2019
1 parent 1ad6f86 commit 67ac3fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions extlib/simplesamlphp/lib/SimpleSAML/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ private static function defer($level, $message, $stats)
// save the message for later
self::$earlyLog[] = array('level' => $level, 'string' => $message, 'statsLog' => $stats);


// register a shutdown handler if needed
if (!self::$shutdownRegistered) {
register_shutdown_function(array('SimpleSAML\Logger', 'flush'));
Expand Down
8 changes: 7 additions & 1 deletion extlib/simplesamlphp/lib/SimpleSAML/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,10 @@ public function markDirty()

$this->dirty = true;

// Moodle auth_saml2 hack, because we register a shutdown handler in
// moodle in the constructor we don't need to register a callback here.
return;

if (!function_exists('header_register_callback')) {
// PHP version < 5.4, can't register the callback
return;
Expand All @@ -511,7 +515,9 @@ public function markDirty()
*/
public function __destruct()
{
$this->save();
// Moodle auth_saml2 hack, we don't need to save here because we have
// a custom shutdown handle registered with moodle.
// $this->save();
}

/**
Expand Down

0 comments on commit 67ac3fe

Please sign in to comment.