MDL-81192 sessions: Prevent false positive session change errors

If $CFG->enable_read_only_sessions_debug was not enabled, debugging could be
enabled part-way through a request when restart_with_write_lock was
called. This meant that a diff between the initial and final session
would be made during write_close(), although the intial session state
was never captured. This generated false positives in the logs, and it
thought any variable set in the session was a change from the original
value.

This ensures that debugging is enabled before the debug flag is allowed
to change, preventing false positives.
This commit is contained in:
Mark Johnson
2024-04-11 08:55:11 +01:00
parent b621a7e4b3
commit 337a0ee705
+3 -1
View File
@@ -89,7 +89,9 @@ class manager {
public static function restart_with_write_lock(bool $readonlysession) {
global $CFG;
self::$requireslockdebug = !$readonlysession;
if (!empty($CFG->enable_read_only_sessions_debug)) {
self::$requireslockdebug = !$readonlysession;
}
if (self::$sessionactive && !self::$handler->requires_write_lock()) {
@self::$handler->abort();