Unyson
Unyson copied to clipboard
PHP Warning: session_start()
PHP Log is filling up with these.
PHP Warning: session_start(): Cannot start session when headers already sent in /home/customer/www/xxxxxxxx/public_html/wp-content/plugins/unyson/framework/helpers/class-fw-session.php on line 13
here, too
PHP Warning: session_start(): Session cannot be started after headers have already been sent in /.../wp-content/plugins/unyson/framework/includes/hooks.php on line 259
The problem is still relevant
+1
The plugin also causes this in Site Health:
An active PHP session was detected
Performance
A PHP session was created by a session_start()
function call. This interferes with REST API and loopback requests. The session should be closed by session_write_close()
before making any HTTP requests.
same issue here, have you found a fix?
* Start the session before the content is sent to prevent the "headers already sent" warning
* @internal
*/
function _action_fw_flash_message_backend_prepare() {
if ( apply_filters( 'fw_use_sessions', true ) && ! session_id() ) {
**session_start();**
}
}
/**
* In ajax it's not possible to call flash message after headers were sent,
* so there will be no "headers already sent" warning.
* Also in the Backups extension, are made many internal ajax request,
* each creating a new independent request that don't remember/use session cookie from previous request,
* thus on server side are created many (not used) new sessions.
*/
! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
&&
! session_id()
) {
**session_start();**
}
}
I dropped this into the plugin. Hopefully they can make this permanent. stackoverflow.com
Changed session_start();
to session_start(['read_and_close' => true,]);
in:
unyson/framework/helpers/class-fw-session.php line 13 unyson/framework/includes/hooks.php lines 229 and 259