How can I fix the problem with sessions?

Top WooCommerce & WordPress Plugins Forums Email Verification for WooCommerce How can I fix the problem with sessions?

  • This topic has 2 replies, 2 voices, and was last updated 1 year ago by Pablo.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #101464
    Alexander
    Guest

    When I try to check website health it shows the following warning whe I enable the plugin. If I disable it message dissapears. I’m running the lastes wordpress version 5.8.2 and a Native PHP Sessions for WordPress for managing sessions in DB.

    Se creó una sesión PHP mediante una llamada a la función session_start(). Esto interfiere con la API REST y las solicitudes de bucle invertido. La sesión debe cerrarse en session_write_close() antes de realizar cualquier solicitud HTTP.

    #101465
    Alexander
    Guest

    I found this in stackoverflow: (Please include it in next release)

    In most cases, the real reason of the above errors is the incorrect mechanism for using PHP sessions within plugins or themes when they are using the session_start() function.

    Now you need to identify what plugin cause this issue by deactive your plugin one by one.

    Then in that plugin, you need to find a piece of code similar to this:

    if ( !session_id() ) {
        session_start();
    }
    

    then change it to:

    if ( !session_id() ) {
        session_start( [
            'read_and_close' => true,
        ] );
    }
    #107541
    Pablo
    Moderator
    Plugin Support

    Hello,

    Just a note, this is fixed already. The session will start with the arguments from the option:
    – Advanced > Session start params

    And by default, it will already start with the read_and_close as true.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.