• While trying to edit a field group, I noticed that my changes were not being saved. When I looked at the web server logs I saw entries like this…

    AH01071: Got error 'PHP message: PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0\n'

    So I enabled the developer tools on my web browser and examined the contents of the post. Sure enough, there was easily over 1000 variables being posted (it is a field group with a lot of stuff in it).

    I suppose I could break them out into separate groups. But wouldn’t it be better if the settings for a group were posted as a single variable with JSON data in it?

Viewing 1 replies (of 1 total)
  • Thread Starter wp_kc

    (@wp_kc)

    Some additional details…

    Server setup:

    • Debian 9
    • WordPress – Version 4.9.8
    • PHP 7.0 FPM
    • Advanced Custom Fields – Version 4.4.12
    • Advanced Custom Fields: Flexible Content Field – Version 2.1.0 (w/valid license)
    • Advanced Custom Fields: Repeater Field – Version 2.1.0 (w/valid license)

    Conditions causing the bug:

    • The problem occurs when trying to add a new location rule to a field group using a single flexible content field.
    • The flexible content field had 12 layouts, with a total of 37 sub-fields among them.
    • The field group had 6 Location rules.
    • 8 ‘Hide on Screen’ items were checkmarked
    • This setup had been working in the past on the same server, with the same configurations files.
    • Trying to add a new location rule resulted in the last 3 layouts (along with their 7 sub-fields) being deleted. The new rule also was not saved. And the last field of the last surviving layout was deleted, as well as some settings of the second to last sub-field.

    Temporary work-around:
    I bumped the php.ini variable ‘max_input_vars’ up to 2000, restarted apache, reconstructed the field group and was able to save it. So too many form variables being submitted at once is definitely causing the problem. Luckily, everything that used that field group was restored to normal operation after reconstructing the field group. Then I returned ‘max_input_vars’ to its default value of 1000 and restarted apache again to prevent attackers from trying to abuse GET and POST requests.

    Suggested solution:
    It is my understanding that WordPress is moving toward using its REST-API for all screens in the admin area. Maybe now is a good time to start converting ACF to submit all data from the field group editor as a single JSON data string. This would avoid triggering the default 1000 input variable setting on apache.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP: Input variables exceeded 1000’ is closed to new replies.