fix overwriting of request's locale if attribute _locale is missing
use while loop for iterating

The other method limits the number of results without taking the
constraints into account.

Fixes GH-7883
remove validation related headers when needed
Merge branch '2.1' into 2.2

* 2.1:
  remove validation related headers when needed
  use while loop for iterating
  [Filesystem] copy() is not working when open_basedir is set

Conflicts:
	src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php