Updated rfc1867 code (taken from PHP 5.3 and changed to work with suhosin).