Skip to content

Commit 27e203c

Browse files
committed
Fix role permissions update silently failing with many maps
getFormParams() submitted every checkbox unconditionally — checked as "1" and unchecked as "". With 328 maps x 3 permission checkboxes = 984 POST vars, plus the other form fields, PHP's default max_input_vars=1000 limit is exceeded. PHP silently truncates $_POST at that point. The submit button (_submit) is rendered after all permission checkboxes and gets dropped, causing submitted() to return false and is_action() to return false — resulting in the form appearing to do nothing with no error shown. Fix by not submitting unchecked checkboxes at all, matching standard HTML form behaviour. get_checkbox() already returns false for both absent keys and empty strings, and updateRolePerms() deletes all existing permissions before re-inserting the checked ones, so the behaviour is identical.
1 parent e6430eb commit 27e203c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FIX: Updating role permissions silently fails when there are many maps due to PHP max_input_vars limit being exceeded

share/frontend/nagvis-js/js/ajax.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,10 @@ function getFormParams(formId, skipHelperFields) {
194194
} else if (aFields[i].type == "checkbox") {
195195
if (aFields[i].checked) {
196196
add_data(aFields[i].name, aFields[i].value);
197-
} else {
198-
add_data(aFields[i].name, "");
199197
}
198+
// Unchecked checkboxes are intentionally not submitted, matching standard
199+
// HTML form behaviour. This prevents hitting PHP's max_input_vars limit
200+
// on forms with many checkboxes (e.g. role permissions with many maps).
200201
} else if (aFields[i].type == "radio") {
201202
if (aFields[i].checked) {
202203
add_data(aFields[i].name, aFields[i].value);

0 commit comments

Comments
 (0)