Added fixes from PHP.NET to rfc1867.c (bug #54939, bug #55510)