phash: return forward declarations, fix borked phash