Post array getting truncated, max_input_vars not working

久未见 提交于 2019-12-13 19:20:03

问题


I'm developing an opencart solution with a cascading option plugin in the admin backend. As such, when saving the form, products with a large combination of options are creating large $_POST arrays.

As far as I can see, the array (which is just over 1000 keys long for this product) is being truncated around the 1000 mark (which fits in with the default value of max_input_vars).

I am on php 5.3.29 which should allow me to change max_input vars ini setting. I have added to the local php.ini and also tried the server php.ini. My phpinfo() says max_input_vars: 3000, but the array is still truncating at the same point.

I have surmised that it's not a post_max_size error as adding dummy text into smaller key post variables does not truncate at a different point, but am not sure if any other ini variables could affect this.

I have also checked in Charles debugger, the full post array is definitely being posted across.

Any suggestions?


回答1:


I had the same issue, and I fixed it by setting max_input_vars value in this php.ini: /etc/php5/apache2/php.ini

even though php_info() reported a different php.ini used (/etc/php5/cli/php.ini). BTW, before I stumbled upon the solution, I also tried setting up the value in .htaccess (in the web page root directory), with no effect.

This looks like a possible bug in PHP 5.5. In any case, I suggest locating all php.ini files on your server ("locate php.ini") and setting max_input_vars in all of them (or the first one that works, eh). Don't forget to restart Apache so this takes effect (sudo /etc/init.d/apache2 restart)

BTW, my PHP Version is 5.5.9-1ubuntu4.5, installed on Ubuntu 14.04.



来源:https://stackoverflow.com/questions/28978977/post-array-getting-truncated-max-input-vars-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!