WPIntell

Source evidence

Session data getting wiped out randomly

Native PHP Sessions · support · 2022-03-23T23:16:00+00:00

complaintsentiment
mediumseverity
0.93relevance
3replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

6 / 30 rows with source links

20.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

24 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
acurran unresolved
In my web application I have noticed the session data getting wiped out randomly/intermittently. When this happens there is a PHP warning msg: ‘Warning: session_start(): Failed to decode session object. Session has been destroyed in ….’. I’m wondering this issue could be connected to this plugin. Any ideas? I’m using latest version of WP (5.9.2) and WordPress Native PHP Sessions (1.2.4). In my code I check session id and initiate a session if there is none: public function start_session() { if (!session_id()) { session_start(); } } This is triggered by the init hook. This topic was modified 4 years, 2 months ago by acurran . Hey @acurran , Here’s a Stack Overflow thread that seems relevant : When using this option, CodeIgniter stores session data in a table called ci_sessions, specifically in the ‘data’ column. By default, CodeIgniter creates this column as a blob datatype which has a maximum data size of 65,535 bytes. My application was exceeding that size and throwing the error. To remedy the issue, I changed the datatype to mediumblob which has a maximum size of 16,777,215 bytes. Afterwards, my application no longer generated the error and worked as expected. In WP Native PHP Sessions v1.2.4 (released September 2021), we “increase[d] data blob size from 64k to 16M for new session tables; existing tables will need to manually modify the column if they want to apply this change” . My guess would be that your session blob is exceeding the size supported by the column, and you’ll need to manually alter your database column. Hope this helps! Hi @danielbachhuber , Interesting, and it could possibly be related to this. However, I did a test to see what happens when the session data exceeds 64k and I found that the error message was different. I did not get Warning: session_start(): Failed to decode session object. Session has been destroyed in … . Instead I got: Notice: Undefined index: debug in /path/to/my/file.php on line xxx Notice: Trying to access array offset on value of type null in /path/to/my/file.php on line 450 So, I’m not sure if the issue is due to exceeding the blob size limit but I’ll switch the column to use type mediumblob and see if it makes any difference. Thanks, Aidan Sounds good! Let us know what you find.

Comments

3 shown
Daniel Bachhuber 2022-03-28T00:55:00+00:00

Hey @acurran , Here’s a Stack Overflow thread that seems relevant : When using this option, CodeIgniter stores session data in a table called ci_sessions, specifically in the ‘data’ column. By default, CodeIgniter creates this column as a blob datatype which has a maximum data size of 65,535 bytes. My application was exceeding that size and throwing the error. To remedy the issue, I changed the datatype to mediumblob which has a maximum size of 16,777,215 bytes. Afterwards, my application no longer generated the error and worked as expected. In WP Native PHP Sessions v1.2.4 (released September 2021), we “increase[d] data blob size from 64k to 16M for new session tables; existing tables will need to manually modify the column if they want to apply this change” . My guess would be that your session blob is exceeding the size supported by the column, and you’ll need to manually alter your database column. Hope this helps!

acurran 2022-03-28T03:09:00+00:00

Hi @danielbachhuber , Interesting, and it could possibly be related to this. However, I did a test to see what happens when the session data exceeds 64k and I found that the error message was different. I did not get Warning: session_start(): Failed to decode session object. Session has been destroyed in … . Instead I got: Notice: Undefined index: debug in /path/to/my/file.php on line xxx Notice: Trying to access array offset on value of type null in /path/to/my/file.php on line 450 So, I’m not sure if the issue is due to exceeding the blob size limit but I’ll switch the column to use type mediumblob and see if it makes any difference. Thanks, Aidan

Daniel Bachhuber 2022-03-29T00:48:00+00:00

Sounds good! Let us know what you find.