PHP

Permissions doesn't get saved

Today I faced with interesting issue when working on one of projects - saving new permissions doesn't work, the page just get reloaded without any message on a page or in the watchdog, and off course nothing is changed on permissions page. I've found the workaround for this issue, but decided to discuss with colleagues and M. Priest told that already saw likely issue and we need to check value of max_input_vars PHP directive.
The root cause here is that when you have a lot user roles configured in Drupal(we had 17 in this project and I know this is not good, but at the point we faced with this issue we didn't fixed extra roles issue yet) and you have configured an admin role(which is general the case) you will receive around 500 values only for admin role and then plus permissions for each other role. The resulting amount of variables could be more then 1000 which is the default value of max_input_vars. So increasing this number to something like 2000 will fix the issue with saving permissions configuration.