Force Log out after save in Greek

Hello to everyone and Happy New Year!

I just installed Invoice Plane. Everything seems to be working just fine apart from one thing. If I change the display language (System Settings -> General) to Greek (my native tongue ) whenever I press Save, or OK it logs me out (the system invalidates Session). It does keep any change I made but it logs me out!

I tested also with English, German and Italian but this problem does not occur. It works fine there. After a little digging I found in the log that every time the system logs me out this is added.

ERROR - 2017-01-04 20:43:16 --> Severity: Notice  --> unserialize(): Error at offset 197 of 239 bytes /opt/lampp/htdocs/invoice/system/libraries/Session.php 741
ERROR - 2017-01-04 20:43:16 --> Severity: Notice  --> unserialize(): Error at offset 197 of 239 bytes /opt/lampp/htdocs/invoice/system/libraries/Session.php 741

197 and 239 (offset x of y bytes) are the usual numbers but from time to time it is different (I assumed it has to do with what I was trying to save/modify).

Since this only occurs in Greek I believe it has something to do with the translation files. I looked but nothing seems to be out of the ordinary.

Any suggestions?
Thank you!
Apostolos

Hello again,

After some more digging I discovered that the problem was with serialization of the data stream. I found a solution by recalculating the length of the elements in serialized array by adding this

$data = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $data);

In system/libraries/Session.php in line 741 before the unserialize was called. It worked since it stopped logging me out but that had a side effect of not correctly displaying the success message. It only produced ?? ??? ???

So after some more digging I found that table ip_sessions in the DB had collation latin_general_ci, So I changed that to utf8_general_ci (as all the other tables were), I removed the added line of code that I mentioned before and it works great.

Check if the collation in this table was different for a reason or not and do what you think is right.

Thank you for a great software!

Best regards,
Apostolos

1 Like

https://development.invoiceplane.com/browse/IP-470