[WIP] Complete rewrite of dop_php