Fix resending headers following redirect

Fixes failing test - all header keys are lowercase
internally so comparison was not working as expected
and the header values were not being properly copied
by array_intersect_assoc as that function compares
both key and value.
since php 5.5.0 /e modifier is deprecated