Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely only on moodle registered shutdown handlers to save the session #327

Merged
merged 1 commit into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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