[wp-trac] [WordPress Trac] #39196: When saving large menus the JSON encoded string was not used. related to #14134
WordPress Trac
noreply at wordpress.org
Wed Jul 5 00:06:04 UTC 2017
#39196: When saving large menus the JSON encoded string was not used. related to
#14134
---------------------------------+-----------------------------------------
Reporter: budaned | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 4.5
Severity: normal | Resolution:
Keywords: has-patch needs- | Focuses: javascript, administration
testing |
---------------------------------+-----------------------------------------
Comment (by ericlewis):
Hey @budaned,
thanks for this bug report! A few questions and notes.
> The solution proposed in #14134 is not properly working. This is because
the values of the JSON string are replacing $_POST but later on $_REQUEST
was being used. The only reason it seemed to still work is because the
post action of the form was populating all the variables, but still failed
when the apache, php or suhosin were reached.
What do you mean the solution is not working? I can reliably reproduce the
problem if I revert the change: in my dev environment only the first 83
items are saved because PHP truncates after 1000 POST values, and enabling
the change allows me to save many more than that. Can you share steps to
reproduce what you are seeing?
I do see that in a few places we use the `$_REQUEST` global to access form
submitted data on the navigation menu page
([https://github.com/WordPress/WordPress/blob/master/wp-admin/nav-
menus.php#L42 1], [https://github.com/WordPress/WordPress/blob/master/wp-
admin/nav-menus.php#L50 2], there are more spots) but I don't see one that
would impact the saving of the menu items. The menu item fields are the
last values in order in the POST request, so they are the only ones liable
to be truncated. The function which extracts the menu item data from the
request [https://github.com/WordPress/WordPress/blob/master/wp-
admin/includes/nav-menu.php#L1014 wp_nav_menu_update_menu_items] gets the
data from `$_POST`, and this is the only place in our codebase that
touches these variables.
We can certainly set `$_REQUEST` with the same data, as that's the default
behavior of PHP and developers may expect those values to exist, core or
otherwise which I've incorporated from your submitted patch in
attachment:39196.diff.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39196#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list