Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Cookies contains Less data

I used https://github.com/js-cookie/js-cookie to set cookies. When I check in browser, cookies are set properly but When I extract cookies on server side(PHP) it behaves abnormally. Sometimes $_COOKIE contains/holds all the content/data which is normal & fine, but sometimes $_COOKIE misses some of the cookie data that is being set in from client side. Screenshot of request & response

You can see in screenshot that sub-total & laravel_session keys are missing in response when I print it in PHP while both are present in request header

I am using Laravel 5.1

like image 938
Khurram Ilyas Avatar asked Feb 19 '26 21:02

Khurram Ilyas


1 Answers

Cookies size is limited to about 4000 bytes ( including key, value, expiration date). you probably exceeded the limit, and your data was cut off.

You can increase the size by changing the value of LimitRequestFieldSize in your apache conf file.

keep in mind that generally, storing so much data in cookies is a sign of bad design, maybe try using session or local storage instead.

like image 104
AnatPort Avatar answered Feb 22 '26 09:02

AnatPort



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!