Description
The method RequestCycle.urlFor(final Component component,final RequestListenerInterface listener, ValueMap params) (RequestCycle.java line 824) obtains a PageParameters instance from the current page or creates a new instance if the page has no associated PageParameters. It then proceeds to add to the PageParameters instance all the parameters passed on the 'params' argument. If its using the PageParameters instance associated with the current Page that means the parameters of the page are permanently altered and any code later in the request cycle that depends upon these parameters is going to be broken.
I believe the soluction would be to clone the PageParameters instance obtained from the Page, as in:
PageParameters pageParameters = page.getPageParameters();
if (pageParameters == null)
else
pageParameters = (PageParameters)pageParameters.clone();
The above change doesn't seem to break any test cases.