Skip to content
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
13 changes: 9 additions & 4 deletions framework/includes/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ function _action_fw_form_frontend_default_styles() {
*/
function _action_fw_flash_message_backend_prepare() {
if ( apply_filters( 'fw_use_sessions', true ) && ! session_id() ) {
session_start();
// We close the session just after reading the information to avoid loopback error.
session_start(['read_and_close' => true, ]);
}
}

Expand Down Expand Up @@ -256,8 +257,12 @@ function _action_fw_flash_message_frontend_prepare() {
&&
! session_id()
) {
session_start();
}
/**
* PHP sessions created with session_start() function may cause issues with REST API and loopback requests due to cURL error 28.
* @internal
*/
session_start(['read_and_close' => true,]);
}
}

add_action( 'send_headers', '_action_fw_flash_message_frontend_prepare', 9999 );
Expand Down Expand Up @@ -381,4 +386,4 @@ function _fw_action_wpml_duplicate_term_options( $original, $translated ) {
}
}
}
}
}