If you have problems updating quantity in checkout/cart

If you have problems updating quantity in checkout/cart

On products with any options and or recurring profiles I was unable to use the update quantity feature in checkout/cart/edit
The result was an empty []
After some hunting I found that the product[key] gets too long and is filtered by Suhosin PHP protection.
This will give an empty array thus

CODE:
if (!empty($this->request->post['quantity']))

never gets fired to do its job.

The standard Suhosin settings for the length is 64 but one product_id + one recurring_id base_encoded and serialized makes up 82 chars.

CODE:
var_dump(strlen('quantity[YToyOntzOjEwOiJwcm9kdWN0X2lkIjtpOjUxO3M6MTI6InJlY3VycmluZ19pZCI7aToxO30=]')); //82

Only took my all afternoon ::) as I first suspected mod_security and then a possible bug with OC :-\

Add the following lines to your php.ini

CODE:
suhosin.post.max_array_index_length = 256
suhosin.post.max_name_length = 256
suhosin.post.max_array_depth = 256
suhosin.request.max_array_index_length = 256
suhosin.request.max_varname_length = 256
suhosin.request.max_array_depth = 256

You can try to add it to your php.ini in the catalog part or, depending on your hosting create a .user.ini (there’s a dot in front of user!)

I hope this will be of any help. I read some people really moved hosts on this matter but it’s an easy fix!

https://suhosin.org/stories/configuration.html#id82


Jayesh Patel
Author
Jayesh Patel

Jayesh Patel is a Professional Web Developer & Designer and the Founder of InCreativeWeb.

As a highly Creative Web/Graphic/UI Designer - Front End / PHP / WordPress / Shopify Developer, with 14+ years of experience, he also provide complete solution from SEO to Digital Marketing. The passion he has for his work, his dedication, and ability to make quick, decisive decisions set him apart from the rest.

His first priority is to create a website with Complete SEO + Speed Up + WordPress Security Code of standards.



Explore

Related Articles

11th April, 2024

W3 Total Cache: A Comprehensive Review & Guide for 2024

8th April, 2024

Top 10 Must-Have Web Design Resources and Tools for 2024

8th April, 2024

Unleash Accessibility Potential in Front-end Development