Suhosin is a (somewhat) commonly installed PHP module used by shared hosting providers to prevent (to some degree) malicious PHP code from compromising a shared environment. Sounds great, but the problem is it spreads its tentacles into areas where, if unaware of its presence, can cause some very unexpected results.
This was the case in Blesta, until recently.
The issue experienced in Blesta was related to session handling. Blesta uses a database to maintain session information, for added security and to permit load balancing. Normally, a session ends when the user closes their browser, however it can be revive if a cookie is stored on the user’s machine and is then read when they revist the site. But because Suhosin encrypts session data by default, our revival code had access to only encrypted data. Essentially, the session couldn’t be revived. The only way to decrypt the data is to have Suhosin do it. So what we did was rename the session prior to starting it, which tricks PHP into thinking the session never ended, and so Suhosin takes over and decrypts the Session just in time.
The psuedo code looks something like this:
$session_id = $_COOKIE[‘session_id’];
session_name($session_id);
session_start();