diff --git a/framework/includes/hooks.php b/framework/includes/hooks.php index 2b9c255b..95502209 100644 --- a/framework/includes/hooks.php +++ b/framework/includes/hooks.php @@ -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, ]); } } @@ -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 ); @@ -381,4 +386,4 @@ function _fw_action_wpml_duplicate_term_options( $original, $translated ) { } } } -} \ No newline at end of file +}