- use php's stream in libmagic
- remove duplicate code (like mime_content_type() compatibility function
now use the same base as finfo_file())
- make it portable (works now on windows too, belongs other OSes)
- don't close caller streams in libmagic (prevent leak and zombie stream)
- string returned by magic_* are freed on magic_close, duplicate before
calling magic_close (set return value)
- if stat failed, don't try to call magic_* (when FILEINFO_MODE_FILE)