WICKET-5013 Wicket Enclosure fails with more than one component
WICKET-5014 Changes in WicketObjects.sizeof(final Serializable object) clashes with <header-contribution> in AjaxResponse

Clone the object before detaching it to calculate its size. Apparently it is not that safe to detach the page at any time of its lifecycle.
WICKET-5013 Wicket Enclosure fails with more than one component
WICKET-5014 Changes in WicketObjects.sizeof(final Serializable object) clashes with <header-contribution> in AjaxResponse

Take the size of the clone.