Filtered UploadedFile instances before store old input in the session
Merge pull request #6833 from ibrasho/4.2-fix-unserializable-UploadedFile-instances

[4.2] Filtered UploadedFile instances before store old input in the session
Tweak some code formatting.
Fix conflicts.