GithubHelp home page GithubHelp logo

String too long about zebra_session HOT 4 CLOSED

schmidtl4 avatar schmidtl4 commented on May 19, 2024
String too long

from zebra_session.

Comments (4)

stefangabos avatar stefangabos commented on May 19, 2024 2

I haven't encountered this issue but it looks like something related to a db difference rather than it being related to PHP version difference.

Here it says that this happens when MySQL is in strict mode and it may be that on a previous environment it wasn't. The result in both cases is the same - data longer than the supported size is written to the db, BUT TRUNCATED TO FIT!, the only difference being that a warning is generated in strict mode, while the action is done silently when not in strict mode (and maybe this is why you had no errors previously)

If the data you have is really large you can change the session_data column type to MEDIUM BLOB or LONG BLOB depending on the size of the data you are planning to store.

Also, if you have to store so much data in the session a better solution would be to use redis or memcache instead of the session

from zebra_session.

stefangabos avatar stefangabos commented on May 19, 2024 1

In my previous comment I forgot to mention that although data is indeed written to the db, it is truncated to fit the allowed size. I updated my previous comment

from zebra_session.

joebordes avatar joebordes commented on May 19, 2024

great answer

from zebra_session.

schmidtl4 avatar schmidtl4 commented on May 19, 2024

Great response. Very helpful. Your instinct about the use of strict mode was spot on. It is possible that the amount of session data grew directly as a result of changing PHP versions, but it is more likely that the use of session data grew as the code features/functionality continued to expand after the change, Combined with the strict mode defaults for PHP 8, the error resulted. The net result is that changing the session_data column to MEDIUM BLOB fixed the issue. Thank you!

from zebra_session.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.