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

Update class-fw-session.php #4051

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion framework/helpers/class-fw-session.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
class FW_Session {
private static function start_session() {
if ( apply_filters( 'fw_use_sessions', true ) && ! session_id() ) {
session_start();
session_start([
'read_and_close' => true, // Closing session to avoid loopback error.
]);
}
}

Expand All @@ -22,17 +24,20 @@ public static function get( $key, $default_value = null ) {
self::start_session();

return fw_akg( $key, $_SESSION, $default_value );
session_write_close();
}

public static function set( $key, $value ) {
self::start_session();

fw_aks( $key, $value, $_SESSION );
session_write_close();
}

public static function del( $key ) {
self::start_session();

fw_aku( $key, $_SESSION );
session_write_close();
}
}